Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Loading and Saving Large Tiff Files

TIFF files can contain large numbers of pages. This can make loading and saving these TIFF files very time consuming. Using an IFD (Image File Directory) speeds up loading, saving and getting information from very large TIFF files. The IFD is essentially an offset within the TIFF file where a page starts.

The CodecsImageInfo class contains a Tiff.ImageFileDirectoryOffset (IFD) member that contains the offset of the desired page within the TIFF file.

To get the RasterCodecs.GetInformation method to use an IFD, set the RasterCodecs.Options.Tiff.Load.ImageFileDirectoryOffset value to the IFD and indicate within this class object that the IFD information is valid. Caution should be taken in using the IFD, since incorrect values could have unexpected consequences. Also note that the page numbering is different if the IFD is used: page 1 is the page whose IFD is indicated in the CodecsLoadOptions class object, page 2 is the page after the page whose IFD is indicated, etc.

For technical reasons, the following restrictions apply when you pass an IFD offset by setting the RasterCodecs.Options.Tiff.Load.ImageFileDirectoryOffset property if you set PageNumber to 1:

  • You cannot add tags, comments or GeoKeys to this IFD. You can only update existing tags, comments or GeoKeys in this IFD.
  • You cannot replace the TIFF page indicated by this IFD.
  • You cannot add a page before this IFD.
  • You cannot delete the page indicated by this IFD.

You can, however, add tags, comments or GeoKeys to an IFD that follows the specified IFD (for example, if PageNumber is >= 2). You can also replace or delete a page that follows the specified IFD and you can insert a page after this IFD.

The CompactFile method lets you compact TIFF files. It also lets you copy or extract one or more pages from a TIFF file and copy them without recompression to another TIFF file.

Whenever you save an image containing a region as a TIFF file format, the region is also saved. Note, however, that the ability to save a region inside a TIFF file must be unlocked. This requires a Document Imaging or Medical Imaging toolkit.