Skip to content

Instantly share code, notes, and snippets.

@dufferzafar
Last active December 22, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dufferzafar/6510166 to your computer and use it in GitHub Desktop.
Save dufferzafar/6510166 to your computer and use it in GitHub Desktop.
GDI+ Image Conversion
pToken := Gdip_Startup()
; ConvertImage("TuneUp.png", A_Desktop "\Hell.bmp" )
Gdip_Shutdown(pToken)
ConvertImage(InFile, OutFile)
{
pBitmap := Gdip_CreateBitmapFromFile(InFile)
Width := Gdip_GetImageWidth(pBitmap), Height := Gdip_GetImageHeight(pBitmap)
pBitmapNew := Gdip_CreateBitmap(Width, Height)
GNew := Gdip_GraphicsFromImage(pBitmapNew), Gdip_SetInterpolationMode(GNew, 7)
Gdip_DrawImage(GNew, pBitmap, 0, 0, Width, Height, 0, 0, Width, Height)
Gdip_SaveBitmapToFile(pBitmapNew, OutFile)
Gdip_DisposeImage(pBitmap), Gdip_DeleteGraphics(GNew), Gdip_DisposeImage(pBitmapNew)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment