Jump to content

how yo get file dimensions?


Recommended Posts

I have an image file & i want to check for its dimensions. Any idea How?

the help file does not say anything about it, so i was wondering if its possible at all?

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

I have an image file & i want to check for its dimensions. Any idea How?

the help file does not say anything about it, so i was wondering if its possible at all?

This is one way - downloaded some time ago.

GEOSoft posted a function _FileGetExDetails(), but I can not find it on the forum.

Local $FileName,$FileSize,$FileType,$FileModified,$FileCreated,$FileAccessed
Local $FileReadyArchiving,$ImageWidthxHeight,$ImageWidthxHeight,$ImageHeight
$ImageFile = "81249931ec3.gif"
$folder = @ScriptDir

;Based on gaFrost's FileExtProperties - kudos to simucal
$objShell = ObjCreate("Shell.Application")
$objFolder = $objShell.Namespace ($folder)
For $strFileName In $objFolder.Items
    If $objFolder.GetDetailsOf ($strFileName, 0) = $ImageFile Then
        $FileName            = $objFolder.GetDetailsOf ($strFileName, 0)
        $FileSize            = $objFolder.GetDetailsOf ($strFileName, 1)
        $FileType            = $objFolder.GetDetailsOf ($strFileName, 2)
        $FileModified        = $objFolder.GetDetailsOf ($strFileName, 3)
        $FileCreated         = $objFolder.GetDetailsOf ($strFileName, 4)
        $FileAccessed        = $objFolder.GetDetailsOf ($strFileName, 5)
        $FileReadyArchiving  = $objFolder.GetDetailsOf ($strFileName, 6)
        $ImageWidthxHeight   = $objFolder.GetDetailsOf ($strFileName, 26)
        $ImageWidth          = $objFolder.GetDetailsOf ($strFileName, 27)
        $ImageHeight         = $objFolder.GetDetailsOf ($strFileName, 28)
        for $x = 0 to 100
            ConsoleWrite($x & "  " & $objFolder.GetDetailsOf ($strFileName, $x) & @CRLF)
        next
        ExitLoop
    EndIf
Next
MsgBox(0,"", "File Name                :"& $FileName & @CRLF & _
             "File Size             :"& $FileSize & @CRLF  & _         
             "Type of File              :"& $FileType & @CRLF  & _
             "File Modified         :"& $FileModified & @CRLF & _       
             "File Created             :"& $FileCreated & @CRLF & _     
             "File Accessed         :"& $FileAccessed & @CRLF & _   
             "File ready for Archiving   :"& $FileReadyArchiving & @CRLF & _ 
             "Image Width x Height          :"& $ImageWidthxHeight & @CRLF & _ 
             "Image Width                :"& $ImageWidth & @CRLF & _ 
             "Image Height               :"& $ImageHeight & @CRLF     )
Link to comment
Share on other sites

This is one way - downloaded some time ago.

GEOSoft posted a function _FileGetExDetails(), but I can not find it on the forum.

There is also _GetExtProperty(), which is based on code posted by Simucal.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ooh this works, thanx

EDIT: I see I see, lets include a link to the topic also:

http://www.autoitscript.com/forum/index.php?showtopic=25859

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Another way is to use GDI+

#include <GuiConstantsEx.au3>
 #include <GDIPlus.au3>
 ;~ #include <ScreenCapture.au3>
 #include <WinAPI.au3>
 
 _GDIPlus_Startup ()
 
 ;~ $hBitmap = _ScreenCapture_Capture ("")
 ;~ $hImage = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap)
 
 $hImage = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\GDIPlus_Image.jpg")
 
 $iX = _GDIPlus_ImageGetWidth ($hImage)
 $iY = _GDIPlus_ImageGetHeight ($hImage)
 
 MsgBox(0,'Image size', $iX & 'x' & $iY)
 
 _GDIPlus_ImageDispose ($hImage)
 ;~ _WinAPI_DeleteObject ($hBitmap)
 _GDIPlus_ShutDown ()
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...