xMasteRx |
|
| Questa funzione l'ho fatta interamente io ^^ Spero sia utile a voi CODICE #include<GDIPlus.au3> #include<WinAPI.au3>
Func _GDIPlus_ImageRedim($fOrig, $fDest, $nW, $nH) ;by »Master at http://autoit.forumcommunity.net - updated 07/06/2012 If Not FileExists($fOrig) Then Return -1 _GDIPlus_Startup() Local $hImage, $split, $ext, $hSrcDC, $hDC, $hBMP, $hBitmapImg, $hGraph, $hWND, $sW, $sH If @error Then Return -1 $split=StringSplit($fDest, ".") $ext=$split[$split[0]] $hWND=_WinAPI_GetDesktopWindow() $hDC=_WinAPI_GetDC($hWND) $hBMP=_WinAPI_CreateCompatibleBitmap($hDC, $nW, $nH) _WinAPI_ReleaseDC($hWND, $hDC) $hBitmapImg=_GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hImage=_GDIPlus_ImageLoadFromFile($fOrig) $sW=_GDIPlus_ImageGetWidth($hImage) $sH=_GDIPlus_ImageGetHeight($hImage) $hGraph=_GDIPlus_ImageGetGraphicsContext($hBitmapImg) _GDIPlus_GraphicsDrawImageRect($hGraph, $hImage, 0, 0, $nW+Ceiling($nW/$sW), $nH+Ceiling($nH/$sH)) $CLSID = _GDIPlus_EncodersGetCLSID($Ext) If $CLSID="" Then $CLSID=_GDIPlus_EncodersGetCLSID("JPG") $fDest&=".jpg" ConsoleWrite(@CRLF&'!_GDIPlus_ImageRedim():Unable to get Encoder CLSID for the extension "'&$Ext&'". The new image was encoded with the JPG encoder.'&@CRLF) EndIf _GDIPlus_ImageSaveToFileEx($hBitmapImg, $fDest, $CLSID) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBMP) _GDIPlus_BitmapDispose($hBitmapImg) _GDIPlus_GraphicsDispose($hGraph) EndFunc Edited by »Master - 7/6/2012, 18:39
|
| |