Aspose.Imaging uses ImageOptionsBase-based objects to set up file formats when saving or creating images. TIFF format, as such, is configured via instances of TiffOptions class. As I've noted in previous article, TiffOptions can also be read from loaded image, so you can get information about format's settings for the particular file. Most of the properties of TiffOptions apply to indivitual TiffFrames, with only few properties related to TiffImage as a collection of TiffFrames. Given multi-image nature of TIFF, I will refer to whole TIFF, represented as TiffImage as "file", and to individual images within, represented as TiffFrame, as "image" or "page".
TiffOptions provides facility to set up TIFF file format as you need. Most of the often used options are supported explicitly and are availible as properties. Changes applied to them will result in according processing of the image data, if needed. TiffOptions also provides a way of working directly with TIFF tags, so anything not explicitly supported by Aspose.Imaging can also be worked upon.
Here I will first describe the properties of TiffOptions, and after them I'll describe the TIFF-specific methods of TiffOptions, they are related to direct access to tag data.
Here are descriptions of explicitly availible properties specific to TiffOptions, roughly grouped by their scope
Person who created the image.
Date and time of image creation.
The name of the document from which this image was scanned.
Pointer to EXIF IFD of the TIFF file.
Either TIFF 6.0 Baseline or TIFF 6.0 Extended.
The title of the image - comment or such. No 2-byte characters allowed.
Names of the inks used in this image. Inks are colors of Separate photometric model.
Name of the page from which this image was scanned.
Page number of the page from which this image was scanned.
Name of the manufacturer of the scanner used to scan this image.
Model of the scanner used to scan this image.
Name and version of software that created this image (or firmware if created by hardware).
Description of the supposed printing environment.
Metadata in XMP format, represented as XmpPacketWrapper (Aspose.Imaging API object to work with XMP metadata)
Dimension and positioning data
Rotation and mirroring of the image.
Resolution unit for the image - inch, centimeter etc.
Offset of the left side of the image from the left side of the page it's on.
Resolution in pixels per resolution unit along horizonal axis.
Offset of the top side of the image from the top side of the page it's on. TIFF's Y axis is downward, so this is positive value.
Resolution in pixels per resolution unit along vertical axis.
Defines how alpha is stored - premultiplied or not. Used when there are more than 3 samples per pixel.
Amount of bits constituting data for single pixel, calculated from BitsPerSample and SamplesPerPixel.
Number of bits per color component. This is an array, as each component can have different bit count. When this is set, SamplesPerPixel will be set to array's length.
This is a per-file setting, not per-image, describes endianness of the file.
Compression method used for image raster data.
Options for Group 3 Fax compression (T4) - 1D compression, 2D compression, no compression, or filling bits to byte boundaries (expanding data size).
Order of bits within bytes
True if there are more samples in SamplesPerPixel than required by photometric setting.
True for tiled images. Large TIFF images are often split into tiles, which can reduce memory use when only part of the image has to be displayed/processed at once.
Color space of the image data. BW with minimum as white, BW with minimum as black, RGB, paletted color, transparency mask (obsolete in TIFF v6.0), separate colors (typically used for CMYK), YCbCr, Cielab, Icclab, Itulab, Logl and Logluv are supported by Aspose.Imaging.
Describes wether colors are stored on separate planes or interleaved.
Predictor for LZW compression - either none, or hozirontal difference.
Numeric format of the sample - unsigned integer, signed integer, floating point, untyped, complex integer, complex floating point. Separate for each component.
Number of color components per pixel.
Type of data stored in subfile. Either just an image, thumbnail for another image in file, page, transparency mask or MRC image.
Coefficients for transformation of RGB data to YCbCR.
Subsampling used for YCbCr image data.
It is closely related to image format, as it also outlays how raster data is located in file.
Height of the image in pixels as stated in TIFF tag.
Width of the image in pixels as stated in TIFF tag.
TIFF images can be organised into strips for faster IO and easier random access. This tag describes count of rows (lines) of image in single strip. Total count of strips per image can be calculated as follows: StripsPerImage = floor ((ImageLength + RowsPerStrip - 1) / RowsPerStrip).
Offsets of the strips constituting the image, relative to beginning of file. This is used to locate actual image data in file, unless tiling is used, then TileOffsets is used.
It is recommended to keep array below 64k bytes in length, and keep strips below 64k bytes each as well.
Number of bytes in strips after compression.
Width of a tile in pixels (number of columns in a tile).
Horizontal, vertical and total tile counts can be calculated as follows:
TilesAcross = (ImageWidth + TileWidth - 1) / TileWidth
TilesDown = (ImageLength + TileLength - 1) / TileLength
TilesPerImage = TilesAcross * TilesDown.
Must be multiple of 16. Might be larger than ImageWidth, but this means either tiles are too large, or image is too small, so tiling is not optimal
The tile length (height) in pixels. This is the number of rows(lines) in each tile. Must be a multiple of 16.
Offsets of tiles in file, relative to beginning of file. Tiles are ordered left-to-right and top-to-bottom. If planar configuration is used, first series of offsets point to tiles of first component plane, then second series for second plane etc, so total count of offsets is total count of tiles multiplied by samples per pixel.
Count of bytes in tile after compression.
Color profiling and processing
Palette used for the image if it is paletted, as stored in file. Palette property is already loaded and processed palette. Length must correspond to formula: 3*(2BitsPerSample).
Stream of color profile embedded in the image.
Values to control halftone function.
Maximum allowed sample value in image, per each channel. 16-bit version.
Minimum allowed sample value in image, per each channel. 16-bit version.
Wether components must be premultiplied by color profile data.
Maximum allowed sample value in image, per each channel. 32-bit version.
Minimum allowed sample value in image, per each channel. 32-bit version.
Describes method used to convert grayscale images to BW.
True if this TiffOptions instance is validly formed, as some options might be conflicting. Use Validate() method to see errors.
Actual TIFF tags in "raw" form.
Count of valid TIFF tags in image, i.e. tags, that can be saved.
Whole file-related properties
Repeating here, as it is actually TiffImage related - the only format property that is set for the whole file, not in pages's tags.
Just the count of pages in document, as such, is read-only, as it is changed when you add or remove pages.
Here are descriptions of TiffOptions-specific methods, mostly working with "raw" tags. Tags are stored as instances of descendants of TiffDataType class, they provide access to tag ID, type and value within the tag. Known tag ID list is availible as TiffTags enum.
Adds new tag to image.
Adds an array of tags to the image.
Returns instance of tag by tag's ID, or null if no such tag is present.
Returns count of valid tags in provided array of tags.
Checks if image contains tag with specified tag ID.
Removes tag by tag ID.
Checks if combination of tags in this TiffOptions is valid.
That's all for now, stay tuned!