Sign in to follow this  
Followers 0
NoMercy

Image

6 posts in this topic

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 ...

Share this post


Link to post
Share on other sites



#3 ·  Posted (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 by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Done. Thank you loads!!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0