spiderblues Posted July 29, 2004 Share Posted July 29, 2004 Hi, does anybody have an idea, how I could get the size of an image, to show the SplashImageOn with the right dimensions? Thanks... Peter Link to comment Share on other sites More sharing options...
emmanuel Posted July 29, 2004 Share Posted July 29, 2004 open it in an editor, just about any picture editor should show you it's size. irfanview should too... "I'm not even supposed to be here today!" -Dante (Hicks) Link to comment Share on other sites More sharing options...
Holger Posted July 29, 2004 Share Posted July 29, 2004 (edited) For Bitmaps "bmp" I could tell you. You could read the file with "FileRead" bitwise and then locate the following positions in the file (hex-values). weight-pos height-pos colordepth 12h(L) 16h(L) 1Ch 13h(H) 17h(H) For "jpg" I look now. Edited July 29, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
spiderblues Posted July 30, 2004 Author Share Posted July 30, 2004 (edited) Thanks Holger, I'll try it next week. Especially I need it for jpg files... Peter Edited July 30, 2004 by spiderblues Link to comment Share on other sites More sharing options...
Bartokv Posted July 30, 2004 Share Posted July 30, 2004 Especially I need it for jpg files...Hmm... If you want to go really LOW level, I could provide some instructions for jpeg images. However, most of it would probably be a little difficult to parse within AutoIt. (ie: ALL jpeg files begin with the two-byte word "FFD8")Older JPEG images typically only have one set of dimensions saved, while digital cameras and some photo editing programs embed the thumbnail information as well (these require a little more parsing). Most Digital cameras also embed information as far as timestamps, camera model, orientation, flash settings, etc. Link to comment Share on other sites More sharing options...
spiderblues Posted July 30, 2004 Author Share Posted July 30, 2004 (edited) I'm using Idoswin Pro as filemanager. There you only have to move over the filename, and the tooltip shows the dimensions and other attributes. I want to show images from digicams as a splash window in different sizes, but want to calculate the x:y ratio. I'm a beginner with autoit, and even don't know how to use the windows api. What I know about programming is PHP , Javascript and C from the old DOS days. But this forum helps a lot. Thanks to you all... Peter Edited July 30, 2004 by spiderblues Link to comment Share on other sites More sharing options...
spiderblues Posted July 30, 2004 Author Share Posted July 30, 2004 Now I found a way, if irfanview is installed. Pleas tell me, wheter this is good or bad what Im doing: $img_file = "test.jpg"; $output_file = "dim.txt" $irfan_path = "C:\Programme\Irfanview\" $cmd = $irfan_path & "i_view32.exe " &$img_file & " /info=" & $output_file & " /killmesoftly" Run ($cmd, "" , @SW_HIDE) The output file looks like this: [test.jpg] File name = test.jpg Directory = Compression = JPG/JFIF Resolution = 0 x 0 DPI Image dimensions = 1536 x 2048 Pixels Print size = 54.19 x 72.25 cm; 21.33 x 28.44 inches Color depth = 16,7 Millions (24 BitsPerPixel) Number of unique colors = 88045 Disk size = 1.90 MB (1988615 Bytes) Current memory size = 9.00 MB (9437224 Bytes) File date/time = 05.02.2004 / 17:07:00 Peter Link to comment Share on other sites More sharing options...
Josbe Posted July 30, 2004 Share Posted July 30, 2004 You could read the values with IniRead. • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
spiderblues Posted July 30, 2004 Author Share Posted July 30, 2004 IniRead() didn't work! Because of the space in thekey "Image dimensions" ? but this is working: $img_file = "test.jpg"; $output_file = "dim.txt" $irfan_path = "C:\Programme\Irfanview\" $key = "Image dimensions" $cmd = $irfan_path & "i_view32.exe " &$img_file & " /info=" & $output_file & " /killmesoftly" Run ($cmd, "" , @SW_HIDE) $file = FileOpen ( $output_file, 0 ) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit Else While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop If StringInStr( $line, $key) > 0 Then ExitLoop Wend EndIf FileClose($file) $dim = StringSplit ( $line, "=" ) $dim[2] = StringReplace ( $dim[2], " ", "") $dim[2] = StringReplace ( $dim[2], "pixels", "") $xy = StringSplit ( $dim[2], "x" ) MsgBox(0, "ImageDimensions", "Width: "& $xy[1] & " Pixel - Height: "& $xy[2] & " Pixel") exit Link to comment Share on other sites More sharing options...
Josbe Posted July 31, 2004 Share Posted July 31, 2004 Ok, based in your output (like Ini file), I maded this lines: This work for me: $imgDims= IniRead( "output.ini", "test.jpg", "Image dimensions", "@") $Dims= StringSplit( $imgDims, " ") Msgbox(0, "Image Dimensions", $imgDims & @LF & "Width: " & $Dims[1] & @LF & "Height: " & $Dims[3]) • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
spiderblues Posted July 31, 2004 Author Share Posted July 31, 2004 So, I get this message: Link to comment Share on other sites More sharing options...
Josbe Posted July 31, 2004 Share Posted July 31, 2004 Wrong? Strange... This works fine for me...EXAMPLEOk, this is "Output.ini" file.[test.jpg] Image dimensions = 1536 x 2048 PixelsThis is the script:$imgDims= IniRead( "output.ini", "test.jpg", "Image dimensions", "@") $Dims= StringSplit( $imgDims, " ") Msgbox(0, "Image Dimensions", $imgDims & @LF & "Width: " & $Dims[1] & @LF & "Height: " & $Dims[3])What Autoit version you use? • AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
spiderblues Posted July 31, 2004 Author Share Posted July 31, 2004 It's 3.0.102! I have to try it again in 10 days, because I'm on vacation... Packing my things now! I'll tell you what I can find out... Peter Link to comment Share on other sites More sharing options...
Bartokv Posted August 6, 2004 Share Posted August 6, 2004 FYI: I posted an example of extracting image dimensions within another thread. Link to comment Share on other sites More sharing options...
spiderblues Posted August 12, 2004 Author Share Posted August 12, 2004 (edited) Thank you for the script, but when I try it with a big image (5 MPixel digicam) it takes a loooong time fpr processing, and the result is always 320x240!! What's wrong? Peter Edited August 12, 2004 by spiderblues Link to comment Share on other sites More sharing options...
Lazycat Posted August 12, 2004 Share Posted August 12, 2004 You can try my new UDF posted in this topic. It fast enough. Please post if problem with 320x240 (thumbnail?) here also. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s]) Link to comment Share on other sites More sharing options...
spiderblues Posted August 13, 2004 Author Share Posted August 13, 2004 Well, that was exactly what I was looking for! Thank you very much Kot!!! Peter 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