NoMercy Posted December 16, 2009 Share Posted December 16, 2009 is it possible to find the width and height of an image? if yes can you show how it can be done please? ive been searching for like 2 days ... Link to comment Share on other sites More sharing options...
JohnOne Posted December 16, 2009 Share Posted December 16, 2009 _GDIPlus_ImageGetHeight _GDIPlus_ImageGetWidrh Maybe I've not used them so cant help you with them GDIPlus.au3 UDF AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
kaotkbliss Posted December 16, 2009 Share Posted December 16, 2009 (edited) Do you need autoit to get the width and height of an image, or do you need the image width and height to add an image into a script? if it's the latter case, then you can open the image in a paint program, most will give you the width and height. To have autoit get the with and height, you might have to use a color of reference to find the top left corner add the coordinents to a variable, then find the top right corner and add to another variable and there is your width, then find your bottom left corner and add to a 3rd variable, the first and 3rd variable become the image height. if it's from a web page, then you can probably have autoit search the source file for the image width and height as that info is in the html code. *edit* or what John1 said Edited December 16, 2009 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
NoMercy Posted December 16, 2009 Author Share Posted December 16, 2009 im doing this.. but the msg box with the values is not displayed... i need autoit to open an image (@DesktopDir & "\screenshot.jpg") then display its dimensions for example... 1024 by 768 #include <GDIPlus.au3> #include <WinAPI.au3> $hImage = @DesktopDir & "\screenshot.jpg" _GDIPlus_ImageGetDimension($hImage) Func _GDIPlus_ImageGetDimension($hImage) Local $aSize[2], $aResult $aResult = DllCall($ghGDIPDll, "uint", "GdipGetImageDimension", "hwnd", $hImage, "float*", 0, "float*", 0) If @error Then Return SetError(@error, @extended, -1) $GDIP_STATUS = $aResult[0] If $GDIP_STATUS Then Return -1 $aSize[0] = $aResult[2] $aSize[1] = $aResult[3] MsgBox(1,"test",$aSize[0]&" - "&$aSize[1]) Return $aSize EndFunc Link to comment Share on other sites More sharing options...
KaFu Posted December 16, 2009 Share Posted December 16, 2009 #include <GDIPlus.au3> ; Initialize GDI+ library _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\screenshot.jpg") $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) MsgBox(0, "", $iX & "x" & $iY) ; Shut down GDI+ library _GDIPlus_Shutdown() OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
NoMercy Posted December 16, 2009 Author Share Posted December 16, 2009 Done. Thank you loads!! 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