0
イメージのサイズを変更しようとしましたが、次の関数では結果が生成されません。関数はビットマップをファイルに保存する必要があるので、そのコードを追加しましたが、何も保存されません。すべてのahkファイルと画像は同じフォルダにあります。イメージのサイズ変更機能で何も保存されない
#Include Gdip.ahk
If !pToken := Gdip_Startup()
{
MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
ExitApp
}
pBitmap := "test.bmp"
pResizedBitmap := Gdip_ResizeBitmap(pBitmap, 200, 0)
Gdip_SaveBitmapToFile(pResizedBitmap, "Resize.png")
Gdip_Shutdown(pToken)
MsgBox
Gdip_ResizeBitmap(pBitmap, PercentOrWH, Dispose=1) { ; returns resized bitmap. By Learning one.
Gdip_GetImageDimensions(pBitmap, origW, origH)
if PercentOrWH contains w,h
{
RegExMatch(PercentOrWH, "i)w(\d*)", w), RegExMatch(PercentOrWH, "i)h(\d*)", h)
NewWidth := w1, NewHeight := h1
NewWidth := (NewWidth = "") ? origW/(origH/NewHeight) : NewWidth
NewHeight := (NewHeight = "") ? origH/(origW/NewWidth) : NewHeight
}
else
NewWidth := origW*PercentOrWH/100, NewHeight := origH*PercentOrWH/100
pBitmap2 := Gdip_CreateBitmap(NewWidth, NewHeight)
G2 := Gdip_GraphicsFromImage(pBitmap2), Gdip_SetSmoothingMode(G2, 4), Gdip_SetInterpolationMode(G2, 7)
Gdip_DrawImage(G2, pBitmap, 0, 0, NewWidth, NewHeight)
Gdip_DeleteGraphics(G2)
if Dispose
Gdip_DisposeImage(pBitmap)
return pBitmap2
}
ご協力いただければ幸いです。
なるほど!助けてくれてありがとう:D – Seung