techzone-imageinfo

I wrote this Delphi unit for Stefan Heymanns HomeGallery. His software is a great online gallery tool (and it's free) and I love to use it for my own image galleries.

EXIF support was one thing I and many others missed in the programm, so I decided to write a simple to use EXIF-reader that could be easily integrated into HomeGallery. So here it is...

Features

  • Simple access to read EXIF infos. One class and one method to read the stuff.
  • Configurable format options to output attribute values as string.
  • Fractions are reduced to their smallest representation.
  • Easy access to the attributes with Delphi datatypes.

What you need...

License

Currently public domain at this stage. More advanced version could stand under MPL in the future.

How to use?

Showing all EXIF-/IPTC attribs in a TMemo
procedure TForm1.cmdTestClick(Sender: TObject);
var n : integer;
imgInfo : TImageInfo;
begin
imgInfo:=NIL;


if dlgOpen.Execute then begin
try
imgInfo:=TImageInfo.Create;

imgInfo.ReadImageInfo(dlgOpen.FileName);

txtImageInfo.Lines.Clear;
for n:=0 to imgInfo.AttributesCount-1 do begin
txtImageInfo.Lines.Add(imgInfo.Attributes[n].Name+'='+imgInfo.Attributes[n].FormatValue);
end;
finally
FreeAndNil(imgInfo);
end;
end;
end;

Accessing a specific attribute

procedure TForm1.cmdTest2Click(Sender: TObject);
var imgInfo : TImageInfo;
attr : TImageAttribute;
begin
imgInfo:=NIL;

if dlgOpen.Execute then begin
try
imgInfo:=TImageInfo.Create;

imgInfo.ReadImageInfo(dlgOpen.FileName);

if imgInfo.FindAttribute('EXIF-APERTUREVALUE',attr) then begin
ShowMessage(attr.FormatValue('.'));
end;
finally
FreeAndNil(imgInfo);
end;
end;
end;