Tiger Posted August 26, 2008 Share Posted August 26, 2008 (edited) I have a picture with height: 400 & width: 400 and i would like to change the size in width 120 and height 120 in pixels. How can I do this Edited August 26, 2008 by Tiger My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 26, 2008 Share Posted August 26, 2008 I have a picture with height: 400 & width: 400 and i would like to change the size in width 120 and height 120 in pixels. How can I do thisChange a picture control in a GUI, or change the format of a picture file (i.e. .jpg, .gif, or .png)? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Tiger Posted August 26, 2008 Author Share Posted August 26, 2008 (edited) I would like to change the size from a picturefile with the GDIPlus functions I have AutoIt Version: 3.2.12.1 Edited August 26, 2008 by Tiger My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Tiger Posted August 26, 2008 Author Share Posted August 26, 2008 Can everyone help me, please My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
komalo Posted August 26, 2008 Share Posted August 26, 2008 use GUICtrlSetPos funtion it will be easier for you [font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font] Link to comment Share on other sites More sharing options...
Tiger Posted August 26, 2008 Author Share Posted August 26, 2008 I would like to change the size of a imagefile, not a GUI My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
smashly Posted August 26, 2008 Share Posted August 26, 2008 Hi,expandcollapse popup#include <GDIPlus.au3> _ImageResize("C:\WINDOWS\Web\Wallpaper\bliss.bmp", @ScriptDir & "\Bliss.jpg", 400, 300) Func _ImageResize($sInImage, $sOutImage, $iW, $iH) Local $hWnd, $hDC, $hBMP, $hImage1, $hImage2, $hGraphic, $CLSID, $i = 0 ;OutFile path, to use later on. Local $sOP = StringLeft($sOutImage, StringInStr($sOutImage, "\", 0, -1)) ;OutFile name, to use later on. Local $sOF = StringMid($sOutImage, StringInStr($sOutImage, "\", 0, -1) + 1) ;OutFile extension , to use for the encoder later on. Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1)) ; Win api to create blank bitmap at the width and height to put your resized image on. $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) _WinAPI_ReleaseDC($hWnd, $hDC) ;Start GDIPlus _GDIPlus_Startup() ;Get the handle of blank bitmap you created above as an image $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP) ;Load the image you want to resize. $hImage2 = _GDIPlus_ImageLoadFromFile($sInImage) ;Get the graphic context of the blank bitmap $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1) ;Draw the loaded image onto the blank bitmap at the size you want _GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iW, $iW) ;Get the encoder of to save the resized image in the format you want. $CLSID = _GDIPlus_EncodersGetCLSID($Ext) ;Generate a number for out file that doesn't already exist, so you don't overwrite an existing image. Do $i += 1 Until (Not FileExists($sOP & $i & "_" & $sOF)) ;Prefix the number to the begining of the output filename $sOutImage = $sOP & $i & "_" & $sOF ;Save the new resized image. _GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID) ;Clean up and shutdown GDIPlus. _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() EndFunc Cheers Link to comment Share on other sites More sharing options...
Tiger Posted August 27, 2008 Author Share Posted August 27, 2008 Thanks for your help. My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now