TiffDecoder Class |
An ImageDecoder used to read Tagged Image File Format (TIFF) images from an image Stream.
Namespace: Atalasoft.Imaging.Codec
The TiffDecoder type exposes the following members.
Name | Description | |
---|---|---|
![]() | TiffDecoder | Initializes a new instance of a %TiffDecoder%. |
Name | Description | |
---|---|---|
![]() | CorrectOrientation | Gets or sets a value that when true (the default) will automatically correct the image orientation by
rotating and/or flipping based on the TIFF_ORIENTATION tag setting. |
![]() | ScaledResampleMethod | Gets or sets the resampling method to use for ReadScaled. |
![]() | SupportedImageType | Obsolete.
Returns the ImageType that the implemented decoder class supports.
(Overrides ImageDecoder.SupportedImageType.) |
Name | Description | |
---|---|---|
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetBestScale | Gets the most effiicient image scale stored within the codec. |
![]() | GetFrameCount | Returns the number of pages in an Encoded Tiff file. (Overrides MultiFramedImageDecoder.GetFrameCount(Stream).) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetImageInfo(Stream) | Retreive information from a Tiff image stored in a Stream without decoding the image data. (Overrides ImageDecoder.GetImageInfo(Stream).) |
![]() | GetImageInfo(Stream, Int32) | Retreive information from a Tiff image stored in a Stream without decoding the image data. (Overrides MultiFramedImageDecoder.GetImageInfo(Stream, Int32).) |
![]() ![]() | GetTiffTag(Int32, Stream, Int32) | Gets a TIFF Tag from a TIFF image stream. |
![]() ![]() ![]() | GetTiffTag(Int32, String, Int32) | Gets a TIFF Tag from a TIFF file. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | IsValidFormat | Returns true if the specified Stream contains an TIFF image. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | Read(Stream, ProgressEventHandler) | Decodes an image from a supplied TIFF image Stream. (Overrides ImageDecoder.Read(Stream, ProgressEventHandler).) |
![]() ![]() | Read(Stream, Int32, ProgressEventHandler) | Decodes an image from a supplied TIFF image Stream specifying a frame index. (Overrides MultiFramedImageDecoder.Read(Stream, Int32, ProgressEventHandler).) |
![]() | ReadRegion | Decodes a specified region of a TIFF image given a source Stream. |
![]() | ReadScaled |
Decodes an image to a specified scale.
|
![]() | ReadStrip | Decodes a specified strip from a TIFF image stream that is encoded with strips. |
![]() | ReadTile | Decodes a specified tile from a TIFF image stream that is encoded with strips. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
By default, when opening a TIFF image using the AtalaImage or Workspace objects, this decoder will automatically be selected from the Decoders collection and does not have to be explicitly set.
TIFF images can contain multiple pages in one file. You may wish to specify which page to read or get information about by specifying the frameindex in the associated Read methods.
TIFF images can store metadata such as EXIF, IPTC, XMP, and other TIFF tags. See the %Atalasoft.Imaging.Metadata% namespace for more information on reading this information.
Split a multi-page TIFF into individual pages
//initialize an instance of a TiffDecoder TiffDecoder tiffReader = new TiffDecoder(); //open the file stream FileStream fs = File.OpenRead(@"C:\Development\Image Database\Tiff\1_multi.tif"); //get the number of pages in the TIFF int pageCount = tiffReader.GetFrameCount(fs); //loop through each page in the TIFF for (int i = 0; i < pageCount; i++) { //seek to the beginning of the file fs.Seek(0, SeekOrigin.Begin); //read the specified frameindex AtalaImage page = tiffReader.Read(fs, i, null); //save the page as a standalone TIFF in the working directory page.Save(Path.GetFileNameWithoutExtension(fs.Name) + "_" + i + ".tif", new TiffEncoder(), null); //dispose of uneeded image page.Dispose(); }
'initialize an instance of a TiffDecoder Dim tiffReader As TiffDecoder = New TiffDecoder() 'open the file stream Dim fs As FileStream = File.OpenRead("C:\Development\Image Database\Tiff\1_multi.tif") 'get the number of pages in the TIFF Dim pageCount As Integer = tiffReader.GetFrameCount(fs) 'loop through each page in the TIFF Dim i As Integer For i = 0 To pageCount - 1 'seek to the beginning of the file fs.Seek(0, SeekOrigin.Begin) 'read the specified frameindex Dim page As AtalaImage = tiffReader.Read(fs, i, Nothing) 'save the page as a standalone TIFF in the working directory page.Save(Path.GetFileNameWithoutExtension(fs.Name) & "_" & i & ".tif", New TiffEncoder(), Nothing) 'dispose of uneeded image page.Dispose() Next