Sign in to follow this  
Followers 0
alienkillaz

Find Out A Pictures Height And Width

13 posts in this topic

#1 ·  Posted (edited)

is their a way for autoit to determine the HxW of a pic (.jpg,.bmp,.gif etc..)

the idea is to make picture buttons in my GUI resize according to the pic i want to use

like if i have a pic thats 600X300 then i would want my GUI to detect the ratio (2:1) and resize the button to 20:10

Edited by alienkillaz

Share this post


Link to post
Share on other sites



is their a way for autoit to determine the HxW of a pic (.jpg,.bmp,.gif etc..)

the idea is to make picture buttons in my GUI resize according to the pic i want to use

like if i have a pic thats 600X300 then i would want my GUI to detect the ratio (2:1) and resize the button to 20:10

You will need to be able to decode the image file format(s) you desire to support. To do so natively in Au3 requires the ability to read binary files -- you will find long sections of code /conversations about how to do that.

You may wish to look for image handling DLLs or 3rd party applications that you can leverage; so you don't have to learn / code all the various header formats for each of the image file_types.

In the chat forum, a thread called something similar to "software I can't live without" has a wide range of apps, including graphics applications like irfanview and others that support command line image analysis / conversion.

I am not aware of any image handling functions (other than slapping icons and pics in GUI controls) currently written in au3.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

You will need to be able to decode the image file format(s) you desire to support. To do so natively in Au3 requires the ability to read binary files -- you will find long sections of code /conversations about how to do that.

You may wish to look for image handling DLLs or 3rd party applications that you can leverage; so you don't have to learn / code all the various header formats for each of the image file_types.

In the chat forum, a thread called something similar to "software I can't live without" has a wide range of apps, including graphics applications like irfanview and others that support command line image analysis / conversion.

I am not aware of any image handling functions (other than slapping icons and pics in GUI controls) currently written in au3.

i was afraid of an answer liek that :think:

Share this post


Link to post
Share on other sites

i was afraid of an answer liek that :think:

IrfanView

http://www.irfanview.com/

usage :

i_view32.exe C:\*.jpg /info=c:\jpgs.txt

Output (c:\jpgs.txt) :

[Test.jpg]

File name = Test.jpg

Directory = C:\

Compression = JPG/JFIF

Resolution = 0 x 0 DPI

Image dimensions = 711 x 460 Pixels

Print size = 25.08 x 16.23 cm; 9.88 x 6.39 inches

Color depth = 16,7 Millions (24 BitsPerPixel)

Number of unique colors = 256

Disk size = 56.29 KB (57642 Bytes)

Current memory size = 959.57 KB (982600 Bytes)

File date/time = 01.07.2004 / 07:35:04

[00-amy_studt0006.jpg]

File name = 00-amy_studt0006.jpg

Directory = C:\

Compression = JPG/JFIF

Resolution = 72 x 72 DPI

Image dimensions = 764 x 568 Pixels

Print size = 26.95 x 20.04 cm; 10.61 x 7.89 inches

Color depth = 16,7 Millions (24 BitsPerPixel)

Number of unique colors = 112255

Disk size = 36.10 KB (36971 Bytes)

Current memory size = 1.24 MB (1301896 Bytes)

File date/time = 04.03.2006 / 05:14:56

[Avviso di protezione.jpg]

File name = Avviso di protezione.jpg

Directory = C:\

Compression = JPG/JFIF

Resolution = 0 x 0 DPI

Image dimensions = 800 x 600 Pixels

Print size = 28.22 x 21.17 cm; 11.11 x 8.33 inches

Color depth = 16,7 Millions (24 BitsPerPixel)

Number of unique colors = 26001

Disk size = 73.67 KB (75434 Bytes)

Current memory size = 1.37 MB (1440040 Bytes)

File date/time = 23.04.2006 / 08:29:58

ecc

Share this post


Link to post
Share on other sites

is their a way for autoit to determine the HxW of a pic (.jpg,.bmp,.gif etc..)

the idea is to make picture buttons in my GUI resize according to the pic i want to use

like if i have a pic thats 600X300 then i would want my GUI to detect the ratio (2:1) and resize the button to 20:10

alienkillaz,

I use image_get_size.au3 by Lazycat

Check out this thread from last year:

http://www.autoitscript.com/forum/index.ph...ge_get_size.au3

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

alienkillaz,

I use image_get_size.au3 by Lazycat

Check out this thread from last year:

http://www.autoitscript.com/forum/index.ph...ge_get_size.au3

taurus905

Here is a script that I use. Some of it is mine, the rest of it is other people's code from the Forums. I put it together for a quick and dirty so it isn't very neat.

Gene

#include <GUIConstants.au3>
#include <Array.au3>
#include <File.au3>
#include <Image_Get_Info.au3>
#Include <GuiList.au3>
Global $GraficViewer, $Grafic, $Rename, $GetPath, $FileList, $NewName, $msg
Global $sLastPath = "", $SS_REALSIZEIMAGE, $iCount, $sCurrPath, $iFileItem
Global $LBS_EXTENDEDSEL, $LVS_EX_ONECLICKACTIVATE, $sItem, $iW, $iH, $sImageProp
Global $aInfo, $PicProperties, $sDateTime, $iCount, $CountLabel

; == GUI generated for Eugene T. Sears with Koda ==
;$GraficViewer = GUICreate("Graphic Viewer", 622, 444, 192, 125)
$GraficViewer = GUICreate("Graphic Viewer", 869, 444, 75, 125)
_SizeImage("K:\_Documents\_Dev\Projects\SLT\Graphics\Navy Days A2.jpg")
;$Grafic = GUICtrlCreatePic("", 230, 10, $iW, $iH, BitOR($GUI_SS_DEFAULT_PIC,$GUI_DOCKSIZE,$SS_REALSIZEIMAGE,$WS_HSCROLL,$WS_VSCROLL));$SS_CENTERIMAGE
GUICtrlSetImage($Grafic, "K:\_Documents\_Dev\Projects\SLT\Graphics\Navy Days A2.jpg")
;GUICtrlSetData ( $Grafic, "K:\_Documents\_Dev\Projects\SLT\Graphics\Navy Days A2.jpg" )
$GetPath = GUICtrlCreateButton("GetPath", 530, 410, 80, 25)
GUICtrlSetTip(-1, "Get path to graphics.")
$FileList = GUICtrlCreateList("", 10, 10, 201, 358, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetTip(-1, "File List")
$CountLabel = GUICtrlCreateLabel($iCount, 15, 355, 125, 25)
$One = GUICtrlCreateButton("One", 10, 380, 40, 25)
$Two = GUICtrlCreateButton("Two", 60, 380, 40, 25)
$Three = GUICtrlCreateButton("Three", 110, 380, 40, 25)
$Four = GUICtrlCreateButton("Four", 160, 380, 40, 25)
$Five = GUICtrlCreateButton("Five", 210, 380, 40, 25)

$NewName = GUICtrlCreateInput("", 10, 410, 510, 24, -1, $WS_EX_CLIENTEDGE)
;$PicProperties = GUICtrlCreateList("", 620, 10, 231, 374, BitOR($LBS_STANDARD,$WS_VSCROLL), $WS_EX_CLIENTEDGE)
$PicProperties = GUICtrlCreateList("", 620, 10, 231, 374, $WS_VSCROLL, $WS_EX_CLIENTEDGE)

$BtnDelete = GUICtrlCreateButton("&Delete", 620, 410, 80, 25)
GUICtrlSetTip($BtnDelete, "Delete the displayed graphic.")


GUISetState(@SW_SHOW)
While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case $msg = $One
   FileMove($sCurrPath & "\" & $iFileItem, $sCurrPath & "\01_" & $iFileItem, 0)
   _RefreshFileList()
  Case $msg = $Two
   FileMove($sCurrPath & "\" & $iFileItem, $sCurrPath & "\02_" & $iFileItem, 0)
   _RefreshFileList()
  Case $msg = $Three
   FileMove($sCurrPath & "\" & $iFileItem, $sCurrPath & "\03_" & $iFileItem, 0)
   _RefreshFileList()
  Case $msg = $Four
   FileMove($sCurrPath & "\" & $iFileItem, $sCurrPath & "\04_" & $iFileItem, 0)
   _RefreshFileList()
  Case $msg = $Five
   If StringLeft($iFileItem, 3) = "01_" Or StringLeft($iFileItem, 3) = "02_" Then
    FileMove($sCurrPath & "\" & $iFileItem, $sCurrPath & "\" & StringLeft($iFileItem, 3) & $sDateTime & "_" & StringMid($iFileItem, 4), 0)
   EndIf
  ;StringLeft($iFileItem, 3) & $sDateTime & StringMid($iFileItem, 4)
   _RefreshFileList()
   
  Case $msg = $GetPath
   _GetFiles()
   
  Case $msg = $FileList
   $iFileItem = GUICtrlRead($FileList, 0)
   If StringUpper(StringRight($iFileItem, 3)) = " AVI" Then
    GUICtrlSetState($PicProperties, $GUI_HIDE)
    $btnStart = GUICtrlCreateButton("Start", 620, 385, 40, 25)
    $btnStop = GUICtrlCreateButton("Stop", 670, 385, 40, 25)
    $btnClose = GUICtrlCreateButton("Close", 720, 385, 40, 25)
   ;GUICtrlSetData($NewName, $sCurrPath & "\" & $iFileItem)
    GUICtrlSetData($NewName, "K:\_Documents\MyVideo\crystal.avi")
    $AviImage = GUICtrlCreateAvi("K:\_Documents\MyVideo\crystal.avi", -1, 230, 10, 489, 368, BitOR($GUI_SS_DEFAULT_AVI, $ACS_AUTOPLAY, $ACS_CENTER), $WS_EX_CLIENTEDGE)
   ;$AviImage = GUICtrlCreateAvi($sCurrPath & "\" & $iFileItem, -1, 230, 10, 489, 368, BitOR($GUI_SS_DEFAULT_AVI, $ACS_AUTOPLAY, $ACS_CENTER), $WS_EX_CLIENTEDGE)
    
    While 1
     $msg = GUIGetMsg()
     
     Select
     Case $msg = $GUI_EVENT_CLOSE
       GUICtrlSetState($AviImage, $GUI_AVICLOSE)
       GUICtrlSetState($AviImage, $GUI_HIDE)
       GUICtrlSetState($PicProperties, $GUI_SHOW)
       ExitLoop
       
      Case $msg = $btnStart
       GUICtrlSetState($AviImage, $GUI_AVISTART)
       
      Case $msg = $btnStop
       GUICtrlSetState($AviImage, $GUI_AVISTOP)
       
      Case $msg = $btnClose
       GUICtrlSetState($AviImage, $GUI_AVICLOSE)
       GUICtrlSetState($AviImage, $GUI_HIDE)
       GUICtrlSetState($PicProperties, $GUI_SHOW)
       GUICtrlSetState($btnStart, $GUI_HIDE)
       GUICtrlSetState($btnStop, $GUI_HIDE)
       GUICtrlSetState($btnClose, $GUI_HIDE)
       
       ExitLoop
     EndSelect
    WEnd
    
    
   Else
   ;MsgBox(0,"1",$iFileItem)
   ;GUICtrlSetData ( $NewName, GUICtrlRead ( $iFileItem ) )
   ;MsgBox(0,"2",GUICtrlRead ( $iFileItem ))
    GUICtrlSetData($NewName, $iFileItem)
    _SizeImage($sCurrPath & "\" & $iFileItem)
    
   ;$Grafic = GUICtrlCreatePic($sCurrPath & "\" & $iFileItem, 230, 10, $iW, $iH, BitOR($GUI_SS_DEFAULT_PIC,$GUI_DOCKSIZE,$SS_REALSIZEIMAGE,$WS_HSCROLL,$WS_VSCROLL));$SS_CENTERIMAGE
    GUICtrlSetImage($Grafic, $sCurrPath & "\" & $iFileItem)
    GUISetState()
   ;GUISetState(@SW_SHOW,$Grafic)
   ;GUISetState(@SW_SHOW,$GraficViewer)
   EndIf

 ;MsgBox(0,"Variable Info.", " $iFileItem = " & $iFileItem ) 

  Case $msg = $BtnDelete
   $sNewItem = ""
   $iLen = StringLen($iFileItem)
   $iBegin = StringInStr($sItem,$iFileItem)
   $sWrkStr = StringMid($sItem,$iBegin+$iLen)
   $iBegin = StringInStr($sWrkStr,"|") + 1
   $iEnd = StringInStr($sWrkStr,"|", 0, 2) 
   $sNewItem = StringMid($sWrkStr,$iBegin,$iEnd-$iBegin)
 ;MsgBox(0,"Variable Info.", " $sNewItem = " & $sNewItem ) 
   FileDelete( $sCurrPath & "\" & $iFileItem)
   _RefreshFileList()
   GUICtrlSetData ( $FileList, "" )
   GUICtrlSetData ( $FileList, $sItem , $sNewItem )

   ControlSend ( "Graphic Viewer", "", "ListBox1", "{DOWN}" )
   ControlSend ( "Graphic Viewer", "", "ListBox1", "{UP}" )
   $iFileItem = GUICtrlRead($FileList, 0)
   
   _SizeImage($sCurrPath & "\" & $iFileItem)
   GUICtrlSetImage($Grafic, $sCurrPath & "\" & $iFileItem)
   GUICtrlSetState ( $FileList, $GUI_FOCUS )
  ;GUISetState()

   
  ;$aWrkArray = StringSplit ( $sItem, "|" )
  ;$iItemCount = _ArrayBinarySearch ( $aWrkArray, $sNewItem , 1 )
 ;MsgBox(0,"Variable Info.", " $iItemCount = " & $iItemCount ) 
   
  ;GUICtrlSetState ( $Grafic, $GUI_HIDE )
  ;ControlHide ( "Graphic Viewer", "", "Static1")
  ;ControlDisable ( "Graphic Viewer", "", "Static1")
  ;ControlFocus ( "Graphic Viewer", "", "ListBox1" )
  ;ControlSend ( "Graphic Viewer", "", "ListBox1", "{DOWN " & $iItemCount & "}" )
 ;MsgBox(0,"Variable Info.", "{DOWN " & $iItemCount & "} = " & "{DOWN " & $iItemCount & "}" ) 
  ;Sleep($iItemCount * 5)
  ;ControlEnable ( "Graphic Viewer", "", "Static1")
  ;ControlShow ( "Graphic Viewer", "", "Static1")
  ;GUICtrlSetState ( $Grafic, $GUI_HIDE )
   
   
  Case $msg = $NewName
  Case Else
  ;;;;;;;
 EndSelect
WEnd
Exit

Func _GetFiles()
 $sItem = ""
 GUICtrlSetData($FileList, $sItem)
 $sTempFile = Random(10000000, 99999999, 1)
 $sTempExt = Random(100, 999, 1)
 $sLastPath = IniRead(@ScriptDir & "\Graphic Viewer.INI", "Paths", "LastPath", "")
 $sCurrPath = FileSelectFolder("Navigate to the Graphics  drive and folder.", "My Computer", 0, $sLastPath)
 IniWrite(@ScriptDir & "\Graphic Viewer.INI", "Paths", "LastPath", $sCurrPath)
;$sCurrShortPath = FileGetShortName ( $sCurrPath & "" )
 $iLen = StringLen($sCurrPath)
 SplashTextOn("Getting File List", "File type 1 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.jpg >" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 2 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.BMP >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 3 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.gif >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 4 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.png >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 5 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.jpeg >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 6 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.tif >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 7 of 7", 200, 100)
;RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.avi >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashOff()
 $iCount = _FileCountLines(@TempDir & "\" & $sTempFile & "." & $sTempExt)
 GUICtrlSetData($CountLabel, $iCount & " Files...")
 $fHandle1 = FileOpen(@TempDir & "\" & $sTempFile & "." & $sTempExt, 0)
 For $i = 1 To $iCount
  $sFileLine = FileReadLine($fHandle1)
  If $i = $iCount Then
   If (StringInStr($sFileLine, "\01_") Or StringInStr($sFileLine, "\02_") Or StringInStr($sFileLine, "\03_") Or StringInStr($sFileLine, "\04_")) Then
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1)
   Else
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1)
   EndIf
   
  Else
   If (StringInStr($sFileLine, "\01_") Or StringInStr($sFileLine, "\02_") Or StringInStr($sFileLine, "\03_") Or StringInStr($sFileLine, "\04_")) Then
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1) & "|"
   Else
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1) & "|"
   EndIf
  EndIf
 ;GUICtrlCreateListViewItem ( $sItem, $FileList )
 Next
 FileClose($fHandle1)
;FileWrite ( @ScriptDir & "\Filist.TXT", $sItem )
 GUICtrlSetData($FileList, $sItem)
 FileDelete(@TempDir & "\" & $sTempFile & "." & $sTempExt)
EndFunc  ;==>_GetFiles

Func _RefreshFileList()
 $sItem = ""
 GUICtrlSetData($FileList, $sItem)
 $sTempFile = Random(10000000, 99999999, 1)
 $sTempExt = Random(100, 999, 1)
 $sLastPath = IniRead(@ScriptDir & "\Graphic Viewer.INI", "Paths", "LastPath", "")
 $iLen = StringLen($sCurrPath)
 IniWrite(@ScriptDir & "\Graphic Viewer.INI", "Paths", "LastPath", $sCurrPath)
 SplashTextOn("Getting File List", "File type 1 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.jpg >" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 2 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.BMP >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 3 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.gif >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 4 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.png >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 5 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.jpeg >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 6 of 7", 200, 100)
 RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.tif >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashTextOn("Getting File List", "File type 7 of 7", 200, 100)
;RunWait(@ComSpec & " /c " & "dir /b /s " & $sCurrPath & "\*.avi >>" & @TempDir & "\" & $sTempFile & "." & $sTempExt, $sCurrPath, @SW_HIDE)
 SplashOff()
 $iCount = _FileCountLines(@TempDir & "\" & $sTempFile & "." & $sTempExt)
 GUICtrlSetData($CountLabel, $iCount & " Files...")
 $fHandle1 = FileOpen(@TempDir & "\" & $sTempFile & "." & $sTempExt, 0)
 For $i = 1 To $iCount
  $sFileLine = FileReadLine($fHandle1)
  If $i = $iCount Then
   If (StringInStr($sFileLine, "\01_") Or StringInStr($sFileLine, "\02_") Or StringInStr($sFileLine, "\03_") Or StringInStr($sFileLine, "\04_")) Then
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1)
   Else
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1)
   EndIf
  Else
   If (StringInStr($sFileLine, "\01_") Or StringInStr($sFileLine, "\02_") Or StringInStr($sFileLine, "\03_") Or StringInStr($sFileLine, "\04_")) Then
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1) & "|"
   Else
    $sItem = $sItem & StringTrimLeft($sFileLine, $iLen + 1) & "|"
   EndIf
  EndIf
 ;GUICtrlCreateListViewItem ( $sItem, $FileList )
 Next
 FileClose($fHandle1)
;FileWrite ( @ScriptDir & "\Filist.TXT", $sItem )
 GUICtrlSetData($FileList, $sItem)
 FileDelete(@TempDir & "\" & $sTempFile & "." & $sTempExt)
EndFunc  ;==>_RefreshFileList

 


Func _SizeImage($fFile)
 $sXY = _GetGraphicSize($fFile)
 $iLenXY = StringLen($sXY)
 $iSplit = StringInStr($sXY, "-")
 $iX = StringLeft($sXY, $iSplit - 1)
 $iY = StringRight($sXY, $iLenXY - $iSplit)
 $iX = Number($iX)
 $iY = Number($iY)
 If $iX > $iY Then
  $iW = 371
  $iH = Int(((371 * $iY) / $iX))
 EndIf
 If $iX = $iY Then
  $iW = 371
  $iH = 368
 EndIf
 If $iY > $iX Then
  $iH = 368
  $iW = Int(((371 * $iX) / $iY))
 EndIf
 
 GUICtrlSetState($Grafic, $GUI_HIDE)
;MsgBox(0,"Info.","$sXY = " & $sXY & " Width = " & $iX & " Hgt = " & $iY & @CRLF & " ScrnW = " & $iW & " ScrnH = " & $iH)
 _GUICtrlListClear ($PicProperties)
 GUICtrlSetData($PicProperties, $sImageProp)
 $sImageProp = ""
 $Grafic = GUICtrlCreatePic($fFile, 230, 10, $iW, $iH, BitOR($GUI_SS_DEFAULT_PIC, $GUI_DOCKSIZE, $SS_REALSIZEIMAGE));$SS_CENTERIMAGE
 GUICtrlSetState($Grafic, $GUI_SHOW)
EndFunc  ;==>_SizeImage

Func _GetGraphicSize($fFile)
;$file = FileOpenDialog("Please select file", "", "Image files (*.jpg;*.tif;*.gif;*.bmp;*.png)");
 $file = $fFile;
 If @error Then Exit
 $aInfo = _ImageGetInfo ($file)
 If @error Then
  MsgBox(0, "Error", "Can't open file.")
  Exit
 EndIf
;MsgBox (0, "All Picture Info", $aInfo)
;MsgBox (0, "Only Width and Height", _ImageGetParam($aInfo, "Width") & "x" & _ImageGetParam($aInfo, "Height"))
 
;$sImageProp = _ArrayToString ($aInfo, @TAB )
 
 $sXY = _ImageGetParam ($aInfo, "Width") & "-" & _ImageGetParam ($aInfo, "Height")
 
 $sDateTime = ""
 
 $sImageProp = $sImageProp & "Width = " & _ImageGetParam ($aInfo, "Width") & "|"
 $sImageProp = $sImageProp & "Height = " & _ImageGetParam ($aInfo, "Height") & "|"
 $sImageProp = $sImageProp & "XResolution = " & _ImageGetParam ($aInfo, "XResolution") & "|"
 $sImageProp = $sImageProp & "YResolution = " & _ImageGetParam ($aInfo, "YResolution") & "|"
 $sImageProp = $sImageProp & "ResolutionUnit = " & _ImageGetParam ($aInfo, "ResolutionUnit") & "|"
 $sImageProp = $sImageProp & "Make = " & _ImageGetParam ($aInfo, "Make") & "|"
 $sImageProp = $sImageProp & "Model = " & _ImageGetParam ($aInfo, "Model") & "|"
 $sImageProp = $sImageProp & "Orientation = " & _ImageGetParam ($aInfo, "Orientation") & "|"
 $sImageProp = $sImageProp & "Software = " & _ImageGetParam ($aInfo, "Software") & "|"
 $sImageProp = $sImageProp & "DateTime = " & _ImageGetParam ($aInfo, "DateTime") & "|"
 $sDateTime = _ImageGetParam ($aInfo, "DateTime")
 $sDateTime = StringReplace($sDateTime, ":", "-")
 $sImageProp = $sImageProp & "ExposureMode = " & _ImageGetParam ($aInfo, "ExposureMode") & "|"
 $sImageProp = $sImageProp & "WhiteBalance = " & _ImageGetParam ($aInfo, "WhiteBalance") & "|"
 $sImageProp = $sImageProp & "DigitalZoomRatio = " & _ImageGetParam ($aInfo, "DigitalZoomRatio") & "|"
 $sImageProp = $sImageProp & "SceneCaptureType = " & _ImageGetParam ($aInfo, "SceneCaptureType") & "|"
 $sImageProp = $sImageProp & "Contrast = " & _ImageGetParam ($aInfo, "Contrast") & "|"
 $sImageProp = $sImageProp & "Saturation = " & _ImageGetParam ($aInfo, "Saturation") & "|"
 $sImageProp = $sImageProp & "Sharpness = " & _ImageGetParam ($aInfo, "Sharpness") & "|"
 $sImageProp = $sImageProp & "ExposureTime = " & _ImageGetParam ($aInfo, "ExposureTime") & "|"
 $sImageProp = $sImageProp & "FNumber = " & _ImageGetParam ($aInfo, "FNumber") & "|"
 $sImageProp = $sImageProp & "ExposureProgram = " & _ImageGetParam ($aInfo, "ExposureProgram") & "|"
 $sImageProp = $sImageProp & "ISO = " & _ImageGetParam ($aInfo, "ISO") & "|"
 $sImageProp = $sImageProp & "ExifVersion = " & _ImageGetParam ($aInfo, "ExifVersion")
 
 #cs
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Width") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Height") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "XResolution") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "YResolution") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ResolutionUnit") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Make") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Model") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Orientation") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ResolutionUnit") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Software") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "DateTime") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ExposureMode") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "WhiteBalance") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "DigitalZoomRatio") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "SceneCaptureType") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Contrast") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Saturation") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "Sharpness") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ExposureTime") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "FNumber") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ExposureProgram") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ISO") & "|"
  $sImageProp = $sImageProp & _ImageGetParam($aInfo, "ExifVersion")
 #ce
 
;MsgBox (0, "All Picture Info2", $sImageProp)
 
 
 Return $sXY
EndFunc  ;==>_GetGraphicSize

[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

perfect solution but it doesnt seem to work for me. Im getting this error when i try to run the example file (image_get_info_example.au3)

Posted Image

Share this post


Link to post
Share on other sites

perfect solution but it doesnt seem to work for me. Im getting this error when i try to run the example file (image_get_info_example.au3)

Posted Image

You have to be running the beta version for that to work...

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites

You have to be running the beta version for that to work...

Gene

Same error here on win98se and autoit3 beta 3, 1, 1, 113

I commented out the dll call [1] .. but I don't know if it work

in proper way now

[1] modified image_get_info.zip

image_get_info_MOD.zip

Share this post


Link to post
Share on other sites

Oh. Yah, euh.

I made a code last time, to sort some of my more than 10 000 pics at home.

It sorts with the Exif datas, if exist, renaming pics with their original date time. If not, all pics are put in "nonexif" folder.

#Include <date.au3>
#include <file.au3>
#Include <GUIconstants.au3>
#include "image_get_info.au3"
$replog = IniRead("exifsorter.ini", "replog", "key", "NotFound")
$adminlog = IniRead("exifsorter.ini", "adminlog", "key", "NotFound")
$defaultfolder = IniRead("exifsorter.ini", "Repertoire", "key", "NotFound")
$sortrep = IniRead("exifsorter.ini", "sortrep", "key", "NotFound")
$sorted = $sortrep & "\"
$namedrep = IniRead("exifsorter.ini", "namedrep", "key", "NotFound")
$named = $namedrep & "\"
;$select = FileSelectFolder("Sélection du dossier", "", 2, $defaultfolder)
$select = IniRead("exifsorter.ini", "Repertoire", "key", "NotFound")
$target = $select & "\"
$nb = IniRead("exifsorter.ini", "NbExtense", "key", "NotFound")
$deep = IniRead("exifsorter.ini", "DupliDeep", "key", "NotFound")
$lastfolder = IniRead("exifsorter.ini", "lastfolder", "key", "NotFound")
$finalfolder = $lastfolder & "\"
$sNewDate = _DateAdd( 'n',-1, _NowCalc())
TrayTip("'ExifSorter'", "Lancement à " & _NowTime(), 20, 1)
$log = FileOpen($replog & $adminlog, 1)
FileWrite($log, "==============================================================================" & @CRLF)
FileWrite($log, "Lancement d'ExifSorter: ")
FileWrite($log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF)
FileWrite($log, "------------------------------------------------------------------------------" & @CRLF)
FileWrite($log, "Fichiers trouvés : " & @CRLF)
FileWrite($log, "------------------------------------------------------------------------------" & @CRLF)
FileWrite($log, "Nom initial --->>> Date EXIF ou de fichier -> Destination" & @CRLF)
FileWrite($log, "------------------------------------------------------------------------------" & @CRLF)
FileClose($log)
For $i=1 to $nb
    $look = IniRead("exifsorter.ini", "ext" & $i, "Key", "NotFound")
    $assembl = "*." & $look
    $search = FileFindFirstFile($target & $assembl)
    If $search = -1 Then
        $log = FileOpen($replog & $adminlog, 1)
        FileWrite($log, @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF)
        FileWrite($log, "Aucun fichier '" & $look & "' trouvé dans " & $target & @CRLF)
        FileWrite($log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF & @CRLF)
        FileClose($log)
    Else
        $log = FileOpen($replog & $adminlog, 1)
        While 1
            $file = FileFindNextFile($search)
            If @error Then ExitLoop
            If Not @error Then
            $aInfo = _ImageGetInfo($target & $file)
            $datefichier = _ImageGetParam($aInfo, "DateTimeOriginal")
            $remplace = StringReplace($datefichier, ":", "")
            $final = StringReplace($remplace, " ", "")
            $t = FileGetTime($target & $file, 1)
            $anneemois = $t[0] & $t[1]
            EndIf
            If $final > 0 Then 
                FileWrite($log, " " & $file & " --->>> " & $final & "." & $look & " -> " & $sorted & @CRLF)
                If FileExists($target & $sorted) Then                   
                    If FileExists($target  & $sorted & "\" & $final & "." & $look) Then
                    FileWrite($log, " " & $final & "." & $look & " existe déjà dans " & $sorted & @CRLF)
                    FileWrite($log, " " & $final & "." & $look & " uniquement renommé" & @CRLF & @CRLF)
                    FileMove($target & $file, $target & $final & "." & $look, 8)
                    Else
                        FileMove($target & $file, $target & $sorted & "\" & $final & "." & $look, 8)
                    EndIf
                Else
                    FileWrite($log, @CRLF & "Création du répertoire : " & $sorted & @CRLF & @CRLF)
                    FileMove($target & $file, $target & $sorted & "\" & $final & "." & $look, 8)
                EndIf       
            Else
                $totale = $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5]
                FileWrite($log, " " & $file & " --->>> " & $totale & "." & $look & @CRLF)
                If Not FileExists($target & $named & $totale & "." & $look) Then
                    FileWrite($log, "Essai d'écriture nouveau nom : " & $totale & "." & $look & @CRLF)
                    For $v=1 to $deep
                        $mrplus = ($v+1)
                        If Not FileExists($target & $named & $totale & $mrplus & "." & $look) Then
                            FileMove($target & $file, $target & $named & $totale & $mrplus & "." & $look, 8)
                            ExitLoop
                        EndIf
                    Next
                EndIf                               
            EndIf
        WEnd
        FileClose($search)
        FileClose($log)
    EndIf
Next
$log = FileOpen($replog & $adminlog, 1)
Sleep(1000)
FileMove($target & $sorted & "*.*", $target & $finalfolder & "*.*", 8)
FileMove($target & $named & "*.*", $target & $finalfolder & "*.*", 8)
FileWrite($log, "==============================================================================" & @CRLF)
FileWrite($log, "Fin du traitement" & @CRLF & @CRLF & @CRLF)
FileClose($log)
MsgBox(4096, "Fin du traitement", "Tous fichiers trouvés triés et déplacés dans " & $finalfolder & @CRLF & @CRLF & "Voilà, voilà...")
TrayTip("clears any tray tip","",0)

You just need a ini file like this :

(all my codes are ina "C:\admintools\" folder.

[replog]
Key=C:\admintools\exifsorter\
[adminlog]
Key=exifsorterlog.txt
[adminlogdoublons]
Key=DupliCatKillerlog.txt
[Repertoire]
Key=C:\rep_oltr\perso\images\flickr
[sortrep]
Key=Exif
[namedrep]
Key=NonExif
[lastfolder]
Key=Trieur
[DupliDeep]
Key=20
[NbExtense]
Key=10
[ext1]
Key=jpg
[ext2]
Key=gif
[ext3]
Key=bmp
[ext4]
Key=tif
[ext5]
Key=jpe
[ext6]
Key=jpeg
[ext7]
Key=wmv
[ext8]
Key=avi
[ext9]
Key=mov
[ext10]
Key=mpeg

Share this post


Link to post
Share on other sites

Apr 26 2006, 10:10 PM??

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

_GDIPlus_ImageLoadFromFile()

_GDIPlus_ImageGetWidth()

_GDIPlus_ImageGetHeight()

Edit: I see its a very old topic

Edited by kip

Share this post


Link to post
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
Sign in to follow this  
Followers 0