Cyclops Posted May 14, 2005 Share Posted May 14, 2005 Hi, i want to knew if its possbile, that i can get width & height of grapic with AutoIt. I looked in the Help, but i didn't have an idea how to realzie that thx, Cyclops Sorry for my cruel english :D Link to comment Share on other sites More sharing options...
Helge Posted May 15, 2005 Share Posted May 15, 2005 Go over to LazyCat's homepage and find a little something that doesexactly what you want, called : "Images size reader"..Simple to use, but if you have problems you can probably just PM him..Good luck anyway ! Link to comment Share on other sites More sharing options...
Cyclops Posted May 15, 2005 Author Share Posted May 15, 2005 (edited) Puh, LazyCat's Script is good code, but i had an idea for an easier one: Func test($graphic) #include <GuiConstants.au3> GuiCreate("pic",0,0,0,0,$WS_POPUPWINDOW) $pic = GUICtrlCreatePic ($graphic,0,0,0,0) $size = ControlGetPos ("pic", "", $pic) Return $size[2] & "x" & $size[3] EndFunc $graphic is the grpahicfile... What do you think about it? Edited May 15, 2005 by Cyclops Sorry for my cruel english :D Link to comment Share on other sites More sharing options...
Ejoc Posted May 15, 2005 Share Posted May 15, 2005 I was working on some JPEG header parsing, whipped a BMP dimension example together, DllStruct.au3 can be found at the link in my sig. expandcollapse popup#cs vi:ts=4 sw=4: Ejoc #ce #include <DllStruct.au3> Opt("MustDeclareVars",1) Local $file,$a ;Get the file to open $file = FileOpenDialog("Open File","","BMP (*.BMP)",1) If @error Then MsgBox(0,"Error","No file") Exit EndIf $a = _BMPDimension($file) msgbox(0,$file,"Width: " & $a[0] & @CRLF & "Height: " & $a[1]) ;============================================= ; _BMPDimension($szFilename) ; Success : array containing width and height ; Failure : sets @ERROR ; -1 _FileReadToDllStruct Failed ; -2 DllStructCreate failed(shouldn't happen) ; -3 Not a BMP ;============================================= Func _BMPDimension($szFileName) Local $a,$rawdata,$p $a = StringSplit("-1,-1",','); returns -1 -1 on failure ; Read the file $rawdata = _FileReadToDllStruct($szFileName) If @error Then SetError(-1) Return $a EndIf ; Create a basic BMP header to get the Dimensions $p = DllStructCreate("byte[18];uint;uint",DllStructGetPtr($rawdata)) If @error Then SetError(-2) DllStructDelete($rawdata) Return $a EndIf ;is it a BMP? If DllStructGetData($p,1,1) <> 0x42 Or DllStructGetData($p,1,2) <> 0x4D Then SetError(-3) DllStructDelete($rawdata) Return $a EndIf ;copy dimensions $a[0] = DllStructGetData($p,2);width $a[1] = DllStructGetData($p,3);height ; free the struct DllStructDelete($rawdata) Return $a EndFunc Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs 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