WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WIA Image Properties


Many have posted questions about getting image attributes, Microsoft does have a free WIA SDK (referenced in attached script) and I put together a quick script to get some. Not sure if it acquires EXIF properties, but during some Googling, I saw EXIF references.

Download required (free download from Microsoft): File wiaaut.dll
http://download.microsoft.com/download/WinXPHome/Utility/2.0/WXP/EN-US/WIAAutSDK.zip

XP sp1 or later and WIAx needs to be registered.
http://msdn.microsoft.com/library/en-us/wiaaut/wia/wiax/overviews/startpagewiaaut.asp?frame=true



;WIADEMO.WBT
;Winbatch 2006D - WIA Image Properties
;
;just a quick hack on a converted VBA sample
;File wiaaut.dll (free download from Microsoft)
; http://download.microsoft.com/download/WinXPHome/Utility/2.0/WXP/EN-US/WIAAutSDK.zip
;
;No error checking, just assumes the ActiveX is registered
;
;Stan Littlefield, September 12, 2006
;////////////////////////////////////////////////////////////////////////////////////////


;insert your own image file
cJPG = "C:\WINDOWS\Web\Wallpaper\Autumn.jpg"
;/////////////////////////////////////////////
If ! FileExist(cJPG) Then Exit
oIMG = CreateObject("WIA.ImageFile")
oIMG.LoadFile(cJPG)
s  = StrCat("Image File: ",cJPG,@CRLF)
s = StrCat(s,"Width = ",oIMG.Width,@CRLF)
s = StrCat(s,"Height = ",oIMG.Height,@CRLF)
s = StrCat(s,"Depth = ",oIMG.PixelDepth,@CRLF)
s = StrCat(s,"HorizontalResolution = ",oIMG.HorizontalResolution,@CRLF)
s = StrCat(s,"VerticalResolution = ",oIMG.VerticalResolution,@CRLF)
s = StrCat(s,"FrameCount = ",oIMG.FrameCount,@CRLF)
If oIMG.IsIndexedPixelFormat Then s = StrCat(s,"Pixel data contains palette indexes",@CRLF)
If oIMG.IsAlphaPixelFormat Then s = StrCat(s,"Pixel data has alpha information",@CRLF)
If oIMG.IsExtendedPixelFormat Then s = StrCat(s,"Pixel data has extended color information (16 bit/channel)",@CRLF)
If oIMG.IsAnimated Then s = StrCat(s,"Image is animated",@CRLF)

If oIMG.Properties.Exists("40091")
   v = oIMG.Properties("40091").Value
   s = StrCat(s,"Title = ",v.String,@CRLF)
EndIf

If oIMG.Properties.Exists("40092")
   v = oIMG.Properties("40092").Value
   s = StrCat(s,"Comment = ",v.String,@CRLF)
EndIf

If oIMG.Properties.Exists("40093")
   v = oIMG.Properties("40093").Value
   s = StrCat(s,"Author = ",v.String,@CRLF)
EndIf

If oIMG.Properties.Exists("40094")
   v = oIMG.Properties("40094").Value
   s = StrCat(s,"Keywords = ",v.String,@CRLF)
EndIf

If oIMG.Properties.Exists("40095")
   v = oIMG.Properties("40095").Value
   s = StrCat(s,"Subject = ",v.String,@CRLF)
EndIf

Message("Image Properties",s)
oIMG=0
Exit
;////////////////////////////////////////////////////////////////////////////

Article ID:   W17244
File Created: 2007:07:03:14:28:58
Last Updated: 2007:07:03:14:28:58