The GetImageInfo method retrieves extra information (Exif, IPTC) from JPEG image.

GetImageInfo vFileName[, vDataType]


Path to image file or safearray containing JPEG image data.

Optional. Specifies type of extra-data to look for (image can contain several data types). Default value is 0. The following values are supported:
0 (default)Search for any data type. First found data will be processed.
1Search for EXIF data only.
2Search for IPTC data only.

Return value

Method returns an instance of ImageInfo object.
This .VBS example prints information about camera model, containing in EXIF data
Set g = CreateObject("shotgraph.image")
file_name = "c:\files\image.jpg"
Set info = g.GetImageInfo(file_name,1)
Wscript.echo info("Model")

ImageInfo class

Object of such class is returned by GetImageInfo method. Object represents collection of different image properties. This collection exists as a "key -- value" relationship in the ImageInfo object. You should know the key name to retrieve its value. EXIF can contain data of various types, both strings and numbers. In case if one key has several values, ImageInfo keeps such value as array of numbers. Therefore, in some cases you should check values using standard VB IsArray or similar function. Rational values are shown as a/b, because every rational value consists of two numbers.
You can retrieve all keys containing in object: the ImageInfo supports standard VB For Each -- Next loop. The following example shows typical VB script retrieving complete EXIF information from image, handling all arrays:
Set g = CreateObject("shotgraph.image")
filename = "c:\images\ixus.jpg"
Set info = g.GetImageInfo(filename)
s = ""
for each key in info
	s = s & key & ": "
	if IsArray(info(key)) then
		ar = info(key)
		for j = 0 to UBound(ar)
			s = s & ar(j) & " "
		s = s & Chr(13) & Chr(10)
		s = s & info(key) & Chr(13) & Chr(10)
	end if
Wscript.echo s

The previous example returns a printout of every key and its value. What these data mean? For example, the key named "Copyright" having value "John Smit" doesn't require comments. But if the key "Flash" has value "1", what means "1"? Or what is the key "LightSource"?
That keys and values can be easy translated to a human-readable form using ImageInfoUnit object (see below). You will see the modified previous example producing HTML output of EXIF data from image file.
Also you can find detailed explanation of values for the most keys on site.

Properties of ImageInfo

Type Read-only. Contains type of retrieved data (1 - EXIF, 2 - IPTC).
ErrorCode Read-only. Contains 0 if there were no errors. Other possible values:
1 - file can not be opened
2 - file can not be recognized as valid JPEG
3 - no EXIF or IPTC data in file.
Count Read-only. Contains amount of retrieved keys.
Item("key") Read-only. Contains value of retrieved key. The value is returned as ImageInfoUnit object.

ImageInfoUnit class

Object of such class is returned by the Item property of ImageInfo object. It converts raw EXIF data to human-readable form.

Properties of ImageInfoUnit

Value Read-only. Contains raw value of key represented by this object.
TextValue Read-only. Contains human-readable form of value (if available).
Description Read-only. Contains description of key (if available).
Name Read-only. Contains name of the key.

ShotGraph uses special XML file containing rules for possible keys and values and their descriptions to decode EXIF and IPTC data. This file is named shotgraph.xml and located in the Windows directory. You can also modify it for your needs, if necessary. Edit it with care, completely understanding what you are doing.
This fragment of ASP code prints EXIF data contained in specified image.

Set g = CreateObject("shotgraph.image")
filename = "c:\images\a13257.jpg"
Set ii = g.GetImageInfo(filename,0)

%><table border=1 cellspacing=0 cellpadding=2>

rowcolor = ""
for each key in ii
	data = ""
	description = ii(key).description
	textvalue = ii(key).textvalue
	if IsArray(ii(key).value) then
		ar = ii(key).value
		for j = 0 to UBound(ar)
			data = data & ar(j) & " "

		if textvalue = "" then		
			data = ii(key).value
			data = textvalue
		end if

	if description = "" then description = " "

	if rowcolor <> "#eeffee" then
		rowcolor = "#eeffee"
		rowcolor = "#f9fff9"
	end if

	%><tr bgcolor="<%=rowcolor%>">
	end if


HTML table (result of script execution)

ApertureValue262144/65536The actual aperture value of lens when the image was taken. Unit is APEX. To convert this value to ordinary F-number(F-stop), calculate this value's power of root 2 (=1.4142).
CompressedBitsPerPixel3/1The average compression ratio of JPEG
DateTime2001:06:09 15:17:32Date/Time of image was last modified.
DateTimeDigitized2001:06:09 15:17:32Date/Time of image digitized.
DateTimeOriginal2001:06:09 15:17:32Date/Time of original image taken.
ExifImageHeight480Height of main image
ExifImageWidth640Width of main image
ExposureBiasValue0/3Exposure bias(compensation) value of taking picture. Unit is APEX(EV).
ExposureTime1/350Exposure time (reciprocal of shutter speed). Unit is second.
FNumber40/10The actual F-number(F-stop) of lens when the image was taken.
Flashflash did not fireFlash mode.
FocalLength346/32Focal length of lens used to take image. Unit is millimeter.
MakeCanonShows manufacturer of digicam.
MaxApertureValue194698/65536Maximum aperture value of lens.
MeteringMode center weighted averageExposure metering method.
ModelCanon DIGITAL IXUSShows model number of digicam.
Orientationtop, left sideThe orientation of the camera relative to the scene, when the image was captured.
ResolutionUnitInchUnit of XResolution/YResolution.
ShutterSpeedValue553859/65536Shutter speed by APEX value. To convert this value to ordinary 'Shutter Speed'; calculate this value's power of 2, then reciprocal.
SubjectDistance3750/1000Distance to focus point, unit is meter.
XResolution180/1Display/Print resolution of image.
YCbCrPositioning1When image format is YCbCr and uses 'Subsampling'(cropping of chroma data, all the digicam do that), defines the chroma sample point of subsampling pixel array.
YResolution180/1Display/Print resolution of image.
canon\DriveModeSingle or timerContinuous drive mode
canon\EasyShootingManual'Easy shooting' mode
canon\Firmware versionFirmware Version 1.0 
canon\FocusModeAI Servo 
canon\Image number1010163 
canon\Image typeIMG:JPEG file 
canon\Owner nameTom Rowan and Sarah Clifton 
canon\Self-Timer0Length in 10ths of second