Jump to content

Recommended Posts

Posted (edited)

#include <GDIPlus.au3>

$hImage = "Autoit.jpg"
_GDIPlus_Startup()
$Width = _GDIPlus_ImageGetWidth($hImage)
$Height = _GDIPlus_ImageGetHeight($hImage)
MsgBox("", "", $Width & "x" & $Height)
GUICreate("Test", $Width, $Height)
GUICtrlCreatePic($hImage, 0, 0, $Width, $Height)
GUISetState()
Sleep(3000)

Not show image size true. Maybe bug? ( I'm using Beta 3.2.9.14 )

Edited by Jex
Posted (edited)

Hi

It's not a bug that I can see , your not using the _GDIPlus function correctly..

_GDIPlus_ImageGetWidth() and _GDIPlus_ImageGetHeight() work with the handle to an image object not an image file.

You need to load the file as an image object and use the handle of the object.

Cheers

Edit: saunders beat me to it.

Edited by smashly
Posted (edited)

Thanks for helps :P

Edit :

But if im use "_GDIPlus_ImageLoadFromFile($Image)"

"GUICtrlCreatePic" not work.

Example :

That work without "_GDIPlus_ImageLoadFromFile($Image)" :

#include <GDIPlus.au3>

_GDIPlus_Startup()
$Image = "Autoit.jpg"
;$hImage = _GDIPlus_ImageLoadFromFile($Image)
$Width = 500;_GDIPlus_ImageGetWidth($hImage)
$Height = 500;_GDIPlus_ImageGetHeight($hImage)
GUICreate("Test", $Width, $Height)
GUICtrlCreatePic($Image, 0, 0, $Width, $Height)
GUISetState()
Sleep(3000)oÝ÷ Ø­¶­p¢¹0ØjºFåºÂ&j¡§E®W´ß¢&jªºZºÚ"µÍÚ[ÛYH  ÑÑTË]LÉÝÂÑÑT×ÔÝ

BÌÍÒ[XYÙHH  ][ÝÐ]]Ú]É][ÝÂÌÍÚ[XYÙHHÑÑT×Ò[XYÙSØYÛQ[J ÌÍÒ[XYÙJBÌÍÕÚYHÑÑT×Ò[XYÙQÙ]ÚY
    ÌÍÚ[XYÙJBÌÍÒZYÚHÑÑT×Ò[XYÙQÙ]ZYÚ
    ÌÍÚ[XYÙJBÕRPÜX]J  ][ÝÕÝ    ][ÝË  ÌÍÕÚY   ÌÍÒZYÚ
BÕRPÝÜX]TXÊ ][ÝÐ]]Ú]É][ÝË ÌÍÕÚY   ÌÍÒZYÚ
BÕRTÙ]Ý]J
BÛY
Ì
Edited by Jex
Posted

Well I must say, that is rather odd. If the image is loaded with the GDI function you are unable to use it with the picture control... hmm, I guess you'll have to dispose it?

Hmm.... yup that works. Give this a try.

#include <GDIPlus.au3>

_GDIPlus_Startup()
$Image = "Autoit.jpg"
$hImage = _GDIPlus_ImageLoadFromFile($Image)
$Width = _GDIPlus_ImageGetWidth($hImage)
$Height = _GDIPlus_ImageGetHeight($hImage)
_GDIPlus_ImageDispose($hImage)
GUICreate("Test", $Width, $Height)
GUICtrlCreatePic("Autoit.jpg", 0, 0, $Width, $Height)
GUISetState()
Sleep(3000)

Not really sure why it won't display the image if you don't release it, but I'm guessing it's an issue with the file already being in use.

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
×
×
  • Create New...