Code: Select all
#Include, lib\Gdip_All.ahk
Gui, ChildOrigin: -Caption +E0x80000 +AlwaysOnTop +ToolWindow +OwnDialogs
Gui, ChildOrigin: +HwndChildhwnd
Gui, ChildOrigin: Show, NA
pToken:=Gdip_Startup()
pBitmap:=Gdip_CreateBitmapFromFile(A_ScriptDir "\SomeFile.png")
w:=h:=0, OriginRud:=45
Gdip_GetImageDimensions(pBitmap,w,h)
Gdip_GetRotatedDimensions(w,h,OriginRud,rw,rh)
rw:=(rw>w?rw:w)
rh:=(rh>h?rh:h)
hbm:=CreateDIBSection(rw,rh), hdc:=CreateCompatibleDC(), obm:=SelectObject(hdc,hbm), G:=Gdip_GraphicsFromHDC(hdc)
Gdip_GraphicsClear(G)
Gdip_ResetWorldTransform(G)
Gdip_TranslateWorldTransform(G, rw//2, rh//2)
Gdip_RotateWorldTransform(G,OriginRud)
Gdip_TranslateWorldTransform(G, -rw//2, -rh//2)
Gdip_DrawImage(G, pBitmap, (rw-w)//2, (rh-h)//2, w, h)
UpdateLayeredWindow(Childhwnd, hdc, 200-rw//2, 200-rh//2, rw, rh)
Gdip_SaveBitmapToFile(pBitmap,A_ScriptDir "\Rotated.png")
SelectObject(hdc,obm), DeleteObject(hbm), DeleteDC(hdc), Gdip_DeleteGraphics(G), Gdip_DisposeImage(pBitmap)
Gdip_Shutdown(pToken)
Return
TIA,
Sam.