Declaration
TIETIFTagsReader = class;
Description
TIETIFTagsReader allows reading of single tags from a TIFF file or stream.
See also:
TIETIFFHandler for a more powerful TIFF handling class.
Var
Tags: TIETIFTagsReader;
...
Tags := TIETIFTagsReader.CreateFromFile('input.tif', 0); // read tags of the first image (page)
If Tags.TagExists(269) then
DocumentName := Tags.GetString(269); // 269 is the document name
If Tags.TagExists(285) then
Pagename := Tags.GetString(285); // 285 is the page name
Tags.free;
// Read EXIF tags saved by Canon cameras
var
ms: TMemoryStream;
tagReader1, tagReader2, tagReader3: TIETifTagsReader;
i: integer;
// some Canon tags
m_nMacroMode, m_nLenghtTimer, m_Quality: integer;
m_ImageType: string;
begin
with ImageEnView1 do
begin
IO.LoadFromFile('Capture_00006.JPG');
with IO.Params.JPEG_MarkerList do begin
i := IndexOf( JPEG_APP1 );
if i>=0 then
begin
// there are EXIF info
ms := TMemoryStream.Create;
ms.Write( MarkerData[i][6], MarkerLength[i] ); // bypass first 4 bytes (must contain 'Exif')
ms.Position := 0;
tagReader1 := TIETifTagsReader.CreateFromStream( ms, 0 ); // read TIFF's IFD
tagReader2 := TIETifTagsReader.CreateFromIFD( tagReader1, 34665 ); // read IFD in tag 34665 (SubEXIF)
tagReader3 := TIETifTagsReader.CreateFromIFD( tagReader2, $927c ); // read IFD in tag $927C (MarkerData - Canon IFD data)
// read Canon EXIF tags
m_nMacroMode := tagReader3.GetIntegerIndexed(1, 1);
m_nLenghtTimer := tagReader3.GetIntegerIndexed(1, 2);
m_Quality := tagReader3.GetIntegerIndexed(1, 3);
m_ImageType := tagReader3.GetString(6);
tagReader3.Free;
tagReader2.Free;
tagReader1.Free;
ms.Free;
end;
end;
end;
end;