rony2006 Posted November 25, 2015 Posted November 25, 2015 Hello, can you give me an example of how I can resize a JPEG/JPG file and then store in another folder? Thanks!
UEZ Posted November 25, 2015 Posted November 25, 2015 Look in the help for for_GDIPlus_ImageLoadFromFile_GDIPlus_ImageResize / _GDIPlus_ImageScale_GDIPlus_ImageSaveToFile Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
rony2006 Posted November 25, 2015 Author Posted November 25, 2015 Thank you, but _GDIPlus_ImageResize can also work with JPEG/JPG?
UEZ Posted November 25, 2015 Posted November 25, 2015 (edited) GDIPlus supported images types: BMP, GIF, JPEG, PNG, TIFF, Exif, WMF, and EMF. When you want to save just add a valid extension to save the bitmap in that format!Example: _GDIPlus_ImageSaveToFile ( $hImage, @ScriptDir & "\MyBitmap.jpg" ) Edited November 25, 2015 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
rony2006 Posted November 26, 2015 Author Posted November 26, 2015 Hello,After reading your replay I made the following script but is not working. I don't have any error but the image is not resized and not saved to @ScriptDir & "\MyBitmap.jpg" )Can you help me please?expandcollapse popup#include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <GUIConstantsEx.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> Example() Func Example() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.jpeg)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf FileCopy($sFileOpenDialog, "D:\test\poza.jpg") EndFunc ;==>Example global $hBitmap = "D:\test\poza.jpg" _GDIPlus_Startup() Local Const $iW = @DesktopWidth, $iH = @DesktopHeight _GDIPlus_ImageResize($hBitmap, $iW / 4, $iH / 4) ;resize image _GDIPlus_ImageSaveToFile ($hBitmap, @ScriptDir & "\MyBitmap.jpg" )
jguinch Posted November 26, 2015 Posted November 26, 2015 As UEZ said, you need to load the file with _GDIPlus_ImageLoadFromFile. _GDIPlus_ImageResize waits for an handle to a bitmap object as first parameter. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
UEZ Posted November 26, 2015 Posted November 26, 2015 Try these lines at the end instead::Global $sBitmap = "D:\test\poza.jpg" _GDIPlus_Startup() Global Const $iW = @DesktopWidth, $iH = @DesktopHeight Global $hBitmap = _GDIPlus_ImageLoadFromFile($sBitmap) Global $hBitmap_Resized = _GDIPlus_ImageResize($hBitmap, $iW / 4, $iH / 4) ;resize image _GDIPlus_ImageSaveToFile ($hBitmap_Resized, @ScriptDir & "\MyBitmap.jpg" ) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_ImageDispose($hBitmap_Resized) _GDIPlus_Shutdown() pixelsearch 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
rony2006 Posted November 26, 2015 Author Posted November 26, 2015 Thank you guys!But I have a little problem: if i have changed"D:\test\poza.jpg"with \test\poza.jpg , my picture is still saved in "D:\test\poza.jpg" Why is this happen?
rony2006 Posted November 27, 2015 Author Posted November 27, 2015 (edited) can someone help me please?i still get the same problem even if i restart the pc Edited November 27, 2015 by rony2006
UEZ Posted November 27, 2015 Posted November 27, 2015 Try with full path instead of a partial path. Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
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