hello,

i have many pictures (most are .tiff) and i need to get the heigt and
weidth of every picture.
i tried using <<CreateObject ("Imaging.Application")>> but its not working.
its only telling me 0 as size.

can anyone please help me??

Re: get width and height properties from picture by Jimmy

Jimmy
Thu Dec 04 02:58:36 CST 2003

Hi,

>-----Original Message-----
>hello,
>
>i have many pictures (most are .tiff) and i need to get
the heigt and
>weidth of every picture.
>i tried using <<CreateObject ("Imaging.Application")>>
but its not working.
>its only telling me 0 as size.
>
>can anyone please help me??
>
>.
>

The following script can extract the info. you want:
Retrieve Extended File Properties


Dim arrHeaders(34)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("d:\temp\pic")
For i = 0 to 33
arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
Next
For Each strFileName in objFolder.Items
For i = 0 to 33
Wscript.echo i & vbtab & arrHeaders(i) _
& ": " & objFolder.GetDetailsOf(strFileName, i)
Next
Next


from TechNet Script Center,
http://www.microsoft.com/technet/scriptcenter/filefolder/s
crff64.asp

Regards,
Jimmy


Re: get width and height properties from picture by mayayana

mayayana
Thu Dec 04 23:36:04 CST 2003


>
> i have many pictures (most are .tiff) and i need to get the heigt and
> weidth of every picture.
> i tried using <<CreateObject ("Imaging.Application")>> but its not
working.
> its only telling me 0 as size.
>

I don't know about Imaging.Application. I've got it on my system
but I can't seem to find any type library info. for it. You can use
the LoadPicture function but it won't work for TIFF.
(BMP, GIF, JPG, ICO...)

I expect that the FolderItem.GetDetailsOf method will be
even more limited. It might work on some JPGs from cameras
but I don't think youll get dimensions from most other files.

The following script will list sizes of files in a folder that's
dropped on it:

Dim FSO, Ht, Wd, oFol, oFils, oFil, arg, sExt, sPath

arg = WScript.Arguments(0)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFol = FSO.GetFolder(arg)
Set oFils = oFol.Files
For Each oFil in oFils
sPath = oFil.Path
sExt = UCase(Right(sPath, 3))
If (sExt = "BMP") or (sExt = "GIF") or (sExt = "JPG") Then
PicObGetSize sPath, Wd, Ht
MsgBox sPath & vbcrlf & "W: " & Wd & vbcrlf & "H: " & Ht
End If
Next
Set oFils = Nothing
Set oFol = Nothing
Set FSO = Nothing


Sub PicObGetSize(sPath1, W1, H1)
Dim oPic
Set oPic = LoadPicture(sPath1)
'-- If display is Set to large fonts use 120 in place of 96.
H1 = (96 * oPic.height) \ 2540
W1 = (96 * oPic.width) \ 2540
Set oPic = Nothing
End Sub