Katie_Deely Posted May 29, 2016 Posted May 29, 2016 Hi there. Sorry to bother again. I don't get the tutorials and examples... Let's say I want to display an image "E:\img\123.jpg" in a GUI. Usually I'd do that by using GUICtrlCreatePic($path, $x, $y, $width, $height). Unfortunately, the width and height are changing with every picture and they are unknown as well... First of all, how I can get the width and height of a given picture? And is there any way that doesn't require me to constantly delete and create that window from scratch? Thanks!
AutoBert Posted May 29, 2016 Posted May 29, 2016 (edited) With GDI-funcs you can get this info: #include <GDIPlus.au3> $sImageName = "C:\Program Files\AutoIt3\Examples\GUI\mslogo.jpg" _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sImageName) $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() MsgBox(64, $sImageName, 'Width: ' & $iX & @CRLF & 'Height: ' & $iY) Ps.: in the spoiler of https://autoit.de/index.php/Thread/21667-Beispiel-BMP-GIF-PNG-JPG-Viewer-Stand-10-02-2012/?page=Thread&threadID=21667 is a old example script of mine. A click on the "kopieren"-Icon helps copying the source. It's running still yet but in the newer versions of autoit the $WM_DROPFILES in line 31 must be deleted. You can drop BMP-, JPG-, GIF- and PNG images to the listview or add images by menu. Doubleclick on a lvitem will schow the image with the ratio of the original image. It's only very small commented in german, but i hope my old scriptcode is good enough for understanding by reading code. Added: BMP-Viewer.au3 and the included GUICtrlPic.au3 Edited May 29, 2016 by AutoBert pixelsearch 1
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