Jump to content

Image


NoMercy
 Share

Recommended Posts

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!

Link to comment
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
Link to comment
Share on other sites

#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()

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...