ImageEn, unit iexClasses

TIETIFFHandler

Properties · Methods · Demos · Examples

Declaration

TIETIFFHandler = class;


Description

This class allows you to read all TIFF tags, edit/add tags and pages, delete pages, and finally save back the modified TIFF. TIETIFFHandler is an older class, so you may find it easier to work with TIEMultiBitmap.
Because it only loads pages as needed, it offers good performance when working very large TIFF files.

Note: TIETIFFHandler does not support the BigTIFF format, as well as some OLD-JPEG tiff files (OLD-JPEG compression is no longer supported by the TIFF standard)


Multiframe TIFF Editing

There are three methods to manipulate multiframe TIFFs (add, delete pages, etc) with ImageEn:

TIEMultiBitmap or TImageEnMView
Load the TIFF into the TIEMultiBitmap, add, delete and move pages, then save. This method offers the most flexibility and compression options, but will be slow with large TIFF files.

TIETIFFHandler
Load the TIFF into the TIETIFFHandler, add, delete and move pages, then save. This method works well with large files, but does not support the BigTIFF format.

Direct File Manipulation
If you are only performing adhoc changes to TIFF content, you may prefer to directly modify the file or stream using global methods or TImageEnIO functions.
Add pages using InsertTIFFImageFile or TImageEnIO.InsertToFileTIFF, and delete pages with DeleteTIFFIm.

Note: To quickly display the content of a large TIFF file in a TImageEnMView, load it on demand

Demo


Demo  Demos\InputOutput\TiffHandler\TiffHandler.dpr
Demo  Demos\InputOutput\TiffHandler2\TiffHandler2.dpr

Examples


// add a custom tag (65000 with 'Hello World') at page 0
mytif := TIETIFFHandler.Create('input.tif');
mytif.SetValue(0, 65000, ttAscii, 'Hello World!');
mytif.WriteFile('output.tif');
mytif.free;

// delete second page (indexed 1) of a multipage tiff
mytif := TIETIFFHandler.Create('input.tif');
mytif.DeletePage(1);
mytif.WriteFile('output.tif');
mytif.free;

// insert a new page from an external file
mytif := TIETIFFHandler.Create('input.tif');
mytif.InsertPageAsFile('external.jpg', 0);
mytif.WriteFile('output.tif');
mytif.free;

// merge two tiff (even they are multipage files..)
mytif := TIETIFFHandler.Create('input-1.tif');
mytif.InsertTIFFFile('input-2.tif', mytif.PagesCount-1);
mytif.WriteFile('output.tif');
mytif.free;

// read tag 305 ('software')
mytif := TIETIFFHandler.Create('input-1.tif');
software := mytif.GetString(0, mytif.FindTag(0, 305));
mytif.free;

Methods and Properties


General
Public Method  Create

Input/Output
Public Method  ReadFile
Public Method  ReadStream
Public Method  InsertTIFFStream
Public Method  InsertTIFFFile
Public Method  InsertPageAsFile
Public Method  InsertPageAsStream
Public Method  InsertPageAsImage
Public Method  WriteFile
Public Method  WriteStream
Public Method  FreeData

Meta Information
Public Property  LittleEndian
Public Property  Version

Tag Information
Public Method  GetTagsCount
Public Method  GetPagesCount
Public Method  GetTagCode
Public Method  GetTagType
Public Method  GetTagLength
Public Method  GetTagLengthInBytes
Public Method  FindTag
Public Method  DeleteTag
Public Method  GetTagDescription
Public Method  ChangeTagCode

Tag Reading
Public Method  GetInteger
Public Method  GetString
Public Method  GetFloat
Public Method  GetValue
Public Method  SaveTagToFile
Public Method  GetValueRAW

Tag Writing
Public Method  SetValue
Public Method  SetValueRAW

Tag Copying
Public Method  CopyTag

Page Handling
Public Method  DeletePage
Public Method  InsertPage
Public Method  MovePage
Public Method  ExchangePage