I have been trying to remove all the black pixels from a grayscale image using GDIP, but no success.
I have already tryed to use
Code: Select all
Gdip_GraphicsClear(pBitmap, 0x00000000)
Code: Select all
Gdip_SetBitmapTransColor(pBitmap, 0x000000)
Here's the code:
Code: Select all
If !pToken := Gdip_Startup()
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
fileName = test.png
pBitmap:= Gdip_CreateBitmapFromFile(fileName)
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
pBitmapGrayscale := Gdip_CreateBitmap(Width,Height)
G := Gdip_GraphicsFromImage(pBitmapGrayscale)
Gdip_GraphicsClear(G, 0x00000000)
Matrix = 0.299|0.299|0.299|0|0|0.587|0.587|0.587|0|0|0.114|0.114|0.114|0|0|0|0|0|1|0|0|0|0|0|1
Gdip_DrawImage(G, pBitmap, 0, 0, Width, Height, 0, 0, Width, Height, Matrix)
Gdip_SaveBitmapToFile(pBitmap1, "pBitmapGrayscale.png")
Gdip_DisposeImage(pBitmap)
Gdip_DeleteGraphics(G)
Gdip_Shutdown(pToken)
Can somebody help me, please?