Code: Select all
;need GDI+ standard library
saveImagetoFile(pathwithoutSlash, ext := "png", open := false) {
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus Error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
pBitmap:=Gdip_CreateBitmapFromClipboard()
FilePath := pathwithoutSlash "." ext
Gdip_SaveBitmapToFile(pBitmap, FilePath)
Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
if ( open = true )
Run, %FilePath%
return FilePath
}