#include <WindowsConstants.au3>
#include <GDIPlus.au3>
_GDIPlus_Startup()
Global $iWidth = 200, $iHeight = 200, $sFileName = "test.png"
$hGUI = GUICreate('GDI+ Example (' & @ScriptName & ')', $iWidth, $iHeight, -1, -1, $WS_POPUP, $WS_EX_CONTROLPARENT)
GUISetBkColor(0xFF00FF, $hGUI)
GUISetState()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hImage = _GDIPlus_BitmapCreateFromFile($sFileName)
$hIA = _GDIPlus_ImageAttributesCreate()
Global $aColors[] = [0x010000,0x000100,0x000001]
$hCurImg = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iWidth, $iHeight, $GDIP_PXF32PARGB)
_GDIPlus_ImageDispose($hImage)
For $i = 0 To 2
$hBufImg = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
$hBufGraph = _GDIPlus_ImageGetGraphicsContext($hBufImg)
_GDIPlus_ImageAttributesSetColorKeys($hIA, 0, True, $aColors[$i], 0xFFFFFF)
_GDIPlus_GraphicsDrawImageRectRect($hBufGraph, $hCurImg, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight, $hIA)
_GDIPlus_ImageDispose($hCurImg)
_GDIPlus_GraphicsDispose($hBufGraph)
$hCurImg = _GDIPlus_BitmapCloneArea($hBufImg, 0, 0, $iWidth, $iHeight, $GDIP_PXF32PARGB)
_GDIPlus_ImageDispose($hBufImg)
Next
; _GDIPlus_ImageSaveToFile($hCurImg, "img.png")
_GDIPlus_GraphicsDrawImage($hGraphics, $hCurImg, 0, 0)
_GDIPlus_ImageDispose($hCurImg)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_ImageAttributesDispose($hIA)
_GDIPlus_Shutdown()
Do
Until GUIGetMsg() = -3