C# Class BitMiracle.LibTiff.Classic.Tiff

Exibir arquivo Open project: Core-Techs/TiffLibrary Class Usage Examples

Public Methods

Method Description
ByteArrayToInts ( byte buffer, int offset, int count ) : int[]

Converts a byte buffer into array of 32-bit values.

ByteArrayToShorts ( byte buffer, int offset, int count ) : short[]

Converts a byte buffer into array of 16-bit values.

CheckTile ( int x, int y, int z, short plane ) : bool

Checks whether the specified (x, y, z, plane) coordinates are within the bounds of the image.

The x parameter is checked against the value of the TiffTag.IMAGEWIDTH tag. The y parameter is checked against the value of the TiffTag.IMAGELENGTH tag. The z parameter is checked against the value of the TiffTag.IMAGEDEPTH tag (if defined). The plane parameter is checked against the value of the TiffTag.SAMPLESPERPIXEL tag if the data are organized in separate planes.

CheckpointDirectory ( ) : bool

Writes the current state of the TIFF directory into the file to make what is currently in the file/stream readable.

Unlike WriteDirectory, CheckpointDirectory does not free up the directory data structures in memory, so they can be updated (as strips/tiles are written) and written again. Reading such a partial file you will at worst get a TIFF read error for the first strip/tile encountered that is incomplete, but you will at least get all the valid data in the file before that. When the file is complete, just use WriteDirectory as usual to finish it off cleanly.

ClientOpen ( string name, string mode, object clientData, TiffStream stream ) : Tiff

Initializes new instance of Tiff class and opens a stream with TIFF data for reading or writing.

This method can be used to read TIFF data from sources other than file. When custom stream class derived from TiffStream is used it is possible to read (or write) TIFF data that reside in memory, database, etc.

Please note, that name is an arbitrary string used as ID for the created Tiff. It's not required to be a file name or anything meaningful at all.

Please read remarks for Open(string, string) method for the list of option flags that can be specified in mode parameter.

Clientdata ( ) : object

Returns the custom client data associated with this Tiff.

Close ( ) : void

Closes a previously opened TIFF file.

This method closes a file or stream that was previously opened with Open(string, string) or ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream). Any buffered data are flushed to the file/stream, including the contents of the current directory (if modified); and all resources are reclaimed.

Compare ( short first, short second, int elementCount ) : int

Compares specified number of elements in two arrays.

ComputeStrip ( int row, short plane ) : int

Computes which strip contains the specified coordinates (row, plane).

A valid strip number is always returned; out-of-range coordinate values are clamped to the bounds of the image. The row parameter is always used in calculating a strip. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

ComputeTile ( int x, int y, int z, short plane ) : int

Computes which tile contains the specified coordinates (x, y, z, plane).

A valid tile number is always returned; out-of-range coordinate values are clamped to the bounds of the image. The x and y parameters are always used in calculating a tile. The z parameter is used if the image is deeper than 1 slice (TiffTag.IMAGEDEPTH > 1). The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

CreateDirectory ( ) : void

Creates a new directory within file/stream.

The newly created directory will not exist on the file/stream till WriteDirectory, CheckpointDirectory, Flush or Close is called.

CurrentDirOffset ( ) : long

Retrieves the file/stream offset of the current directory.

CurrentDirectory ( ) : short

Gets the zero-based index of the current directory.

The zero-based index returned by this method is suitable for use with the SetDirectory method.

CurrentRow ( ) : int

Gets the current row that is being read or written.

The current row is updated each time a read or write is done.

CurrentStrip ( ) : int

Gets the current strip that is being read or written.

The current strip is updated each time a read or write is done.

CurrentTile ( ) : int

Gets the current tile that is being read or written.

The current tile is updated each time a read or write is done.

DataWidth ( TiffType type ) : int

Gets the number of bytes occupied by the item of given type.

DefaultStripSize ( int estimate ) : int

Computes the number of rows for a reasonable-sized strip according to the current settings of the TiffTag.IMAGEWIDTH, TiffTag.BITSPERSAMPLE and TiffTag.SAMPLESPERPIXEL tags and any compression-specific requirements.

If the estimate parameter is non-zero, then it is taken as an estimate of the desired strip size and adjusted according to any compression-specific requirements. The value returned by DefaultStripSize is typically used to define the TiffTag.ROWSPERSTRIP tag. If there is no any unusual requirements DefaultStripSize tries to create strips that have approximately 8 kilobytes of uncompressed data.

DefaultTileSize ( int &width, int &height ) : void

Computes the pixel width and height of a reasonable-sized tile suitable for setting up the TiffTag.TILEWIDTH and TiffTag.TILELENGTH tags.

If the width and height values passed in are non-zero, then they are adjusted to reflect any compression-specific requirements. The returned width and height are constrained to be a multiple of 16 pixels to conform with the TIFF specification.

Dispose ( ) : void

Frees and releases all resources allocated by this Tiff.

Error ( Tiff tif, string method, string format ) : void

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

Error ( string method, string format ) : void

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

ErrorExt ( Tiff tif, object clientData, string method, string format ) : void

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the error handler. Default error handler does not use it. Only custom error handlers may make use of it.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

ErrorExt ( object clientData, string method, string format ) : void

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the error handler. Default error handler does not use it. Only custom error handlers may make use of it.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

FieldWithName ( string name ) : TiffFieldInfo

Retrieves field information for the tag with specified name.

FieldWithTag ( TiffTag tag ) : TiffFieldInfo

Retrieves field information for the specified tag.

FileName ( ) : string

Gets the name of the file or ID string for this Tiff.

If this Tiff was created using Open(string, string) method then value of fileName parameter of Open(string, string) method is returned. If this Tiff was created using ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream) then value of name parameter of ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream) method is returned.

FindCodec ( Compression scheme ) : TiffCodec

Retrieves the codec registered for the specified compression scheme.

LibTiff.Net supports a variety of compression schemes implemented by software codecs. Each codec adheres to a modular interface that provides for the decoding and encoding of image data; as well as some other methods for initialization, setup, cleanup, and the control of default strip and tile sizes. Codecs are identified by the associated value of the TiffTag.COMPRESSION tag.

Other compression schemes may be registered. Registered schemes can also override the built-in versions provided by the library.

FindFieldInfo ( TiffTag tag, TiffType type ) : TiffFieldInfo

Retrieves field information for the specified tag.

FindFieldInfoByName ( string name, TiffType type ) : TiffFieldInfo

Retrieves field information for the tag with specified name.

Flush ( ) : bool

Flushes pending writes to an open TIFF file.

Flush causes any pending writes for the specified file (including writes for the current directory) to be done. In normal operation this call is never needed − the library automatically does any flushing required.

FlushData ( ) : bool

Flushes any pending image data for the specified file to be written out.

FlushData flushes any pending image data for the specified file to be written out; directory-related data are not flushed. In normal operation this call is never needed − the library automatically does any flushing required.

FreeDirectory ( ) : void

Releases storage associated with current directory.

GetA ( int abgr ) : int

Gets the A component from ABGR value returned by ReadRGBAImage.

GetB ( int abgr ) : int

Gets the B component from ABGR value returned by ReadRGBAImage.

GetBitRevTable ( bool reversed ) : byte[]

Retrieves a bit reversal table.

If reversed is false then the table that do not reverse bit values will be retrieved. It is a lookup table that can be used as an identity function; i.e. NoBitRevTable[n] == n.

GetClientInfo ( string name ) : object

Gets the extra information with specified name associated with this Tiff.

GetConfiguredCodecs ( ) : BitMiracle.LibTiff.Classic.TiffCodec[]

Retrieves an array of configured codecs, both built-in and registered by user.

GetField ( TiffTag tag ) : BitMiracle.LibTiff.Classic.FieldValue[]

Gets the value(s) of a tag in an open TIFF file.

GetField returns the value(s) of a tag or pseudo-tag associated with the current directory of the opened TIFF file. The tag is identified by tag. The type and number of values returned is dependent on the tag being requested. You may want to consult "Well-known tags and their value(s) data types" to become familiar with exact data types and calling conventions required for each tag supported by the library.

A pseudo-tag is a parameter that is used to control the operation of the library but whose value is not read or written to the underlying file.

GetFieldDefaulted ( TiffTag tag ) : BitMiracle.LibTiff.Classic.FieldValue[]

Gets the value(s) of a tag in an open TIFF file or default value(s) of a tag if a tag is not defined in the current directory and it has a default value(s).

GetFieldDefaulted returns the value(s) of a tag or pseudo-tag associated with the current directory of the opened TIFF file or default value(s) of a tag if a tag is not defined in the current directory and it has a default value(s). The tag is identified by tag. The type and number of values returned is dependent on the tag being requested. You may want to consult "Well-known tags and their value(s) data types" to become familiar with exact data types and calling conventions required for each tag supported by the library.

A pseudo-tag is a parameter that is used to control the operation of the library but whose value is not read or written to the underlying file.

GetG ( int abgr ) : int

Gets the G component from ABGR value returned by ReadRGBAImage.

GetMode ( ) : int

Gets the mode with which the underlying file or stream was opened.

GetR ( int abgr ) : int

Gets the R component from ABGR value returned by ReadRGBAImage.

GetStream ( ) : TiffStream

Gets the tiff stream.

GetTagListCount ( ) : int

Gets the number of elements in the custom tag list.

GetTagListEntry ( int index ) : int

Retrieves the custom tag with specified index.

GetTagMethods ( ) : TiffTagMethods

Gets the currently used tag methods.

GetVersion ( ) : string

Gets the library version string.

IntsToByteArray ( int source, int srcOffset, int srcCount, byte bytes, int offset ) : void

Converts array of 32-bit values into array of bytes.

IsBigEndian ( ) : bool

Gets the value indicating whether given image data was written in big-endian order.

IsByteSwapped ( ) : bool

Gets the value indicating whether the image data was in a different byte-order than the host computer.

Note that ReadTile, ReadEncodedTile, ReadEncodedStrip and O:BitMiracle.LibTiff.Classic.Tiff.ReadScanline methods already normally perform byte swapping to local host order if needed.

Also note that ReadRawTile and ReadRawStrip do not perform byte swapping to local host order.

IsCodecConfigured ( Compression scheme ) : bool

Checks whether library has working codec for the specific compression scheme.

IsMSB2LSB ( ) : bool

Gets the value indicating whether the image data is being returned in MSB-to-LSB bit order.

IsTiled ( ) : bool

Gets the value indicating whether the image data of this Tiff has a tiled organization.

IsUpSampled ( ) : bool

Gets the value indicating whether the image data returned through the read interface methods is being up-sampled.

The value returned by this method can be useful to applications that want to calculate I/O buffer sizes to reflect this usage (though the usual strip and tile size routines already do this).

LastDirectory ( ) : bool

Returns an indication of whether the current directory is the last directory in the file.

MergeFieldInfo ( TiffFieldInfo info, int count ) : void

Merges given field information to existing one.

NumberOfDirectories ( ) : short

Gets the number of directories in a file.

NumberOfStrips ( ) : int

Retrives the number of strips in the image.

NumberOfTiles ( ) : int

Retrives the number of tiles in the image.

Open ( string fileName, string mode ) : Tiff

Initializes new instance of Tiff class and opens a TIFF file for reading or writing.

Open(string, string) opens a TIFF file whose name is fileName. When a file is opened for appending, existing data will not be touched; instead new data will be written as additional subfiles. If an existing file is opened for writing, all previous data is overwritten.

If a file is opened for reading, the first TIFF directory in the file is automatically read (see SetDirectory for reading directories other than the first). If a file is opened for writing or appending, a default directory is automatically created for writing subsequent data. This directory has all the default values specified in TIFF Revision 6.0: BitsPerSample = 1, ThreshHolding = Threshold.BILEVEL (bilevel art scan), FillOrder = MSB2LSB (most significant bit of each data byte is filled first), Orientation = TOPLEFT (the 0th row represents the visual top of the image, and the 0th column represents the visual left hand side), SamplesPerPixel = 1, RowsPerStrip = infinity, ResolutionUnit = INCH, and Compression = NONE. To alter these values, or to define values for additional fields, SetField must be used.

The mode parameter can include the following flags in addition to the "r", "w", and "a" flags. Note however that option flags must follow the read-write-append specification.

FlagDescription l When creating a new file force information be written with Little-Endian byte order (but see below). b When creating a new file force information be written with Big-Endian byte order (but see below). L Force image data that is read or written to be treated with bits filled from Least Significant Bit (LSB) to Most Significant Bit (MSB). Note that this is the opposite to the way the library has worked from its inception. B Force image data that is read or written to be treated with bits filled from Most Significant Bit (MSB) to Least Significant Bit (LSB); this is the default. H Force image data that is read or written to be treated with bits filled in the same order as the native CPU. C Enable the use of "strip chopping" when reading images that are comprised of a single strip or tile of uncompressed data. Strip chopping is a mechanism by which the library will automatically convert the single-strip image to multiple strips, each of which has about 8 Kilobytes of data. This facility can be useful in reducing the amount of memory used to read an image because the library normally reads each strip in its entirety. Strip chopping does however alter the apparent contents of the image because when an image is divided into multiple strips it looks as though the underlying file contains multiple separate strips. The default behaviour is to enable strip chopping. c Disable the use of strip chopping when reading images. h Read TIFF header only, do not load the first image directory. That could be useful in case of the broken first directory. We can open the file and proceed to the other directories.

By default the library will create new files with the native byte-order of the CPU on which the application is run. This ensures optimal performance and is portable to any application that conforms to the TIFF specification. To force the library to use a specific byte-order when creating a new file the "b" and "l" option flags may be included in the mode parameter; for example, "wb" or "wl".

The use of the "l" and "b" flags is strongly discouraged. These flags are provided solely because numerous vendors do not correctly support TIFF; they only support one of the two byte orders. It is strongly recommended that you not use this feature except to deal with busted apps that write invalid TIFF.

The "L", "B", and "H" flags are intended for applications that can optimize operations on data by using a particular bit order. By default the library returns data in MSB2LSB bit order. Returning data in the bit order of the native CPU makes the most sense but also requires applications to check the value of the TiffTag.FILLORDER tag; something they probably do not do right now.

The "c" option permits applications that only want to look at the tags, for example, to get the unadulterated TIFF tag information.

PrintDirectory ( Stream stream ) : void

Prints formatted description of the contents of the current directory to the specified stream.

PrintDirectory ( Stream stream, TiffPrintFlags flags ) : void

Prints formatted description of the contents of the current directory to the specified stream using specified print (formatting) options.

RGBAImageOK ( string &errorMsg ) : bool

Check the image to see if it can be converted to RGBA format.

To convert the image to RGBA format please use O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage, O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImageOriented, ReadRGBAStrip or ReadRGBATile

Convertible images should follow this rules: samples must be either 1, 2, 4, 8, or 16 bits; colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

RasterScanlineSize ( ) : int

Calculates the size in bytes of a complete decoded and packed raster scanline.

The value returned by RasterScanlineSize may be different from the value returned by ScanlineSize if data is stored as separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

RawStripSize ( int strip ) : long

Computes the number of bytes in a raw (i.e. not decoded) strip.

RawTileSize ( int tile ) : long

Computes the number of bytes in a raw (i.e. not decoded) tile.

ReadBufferSetup ( byte buffer, int size ) : void

Sets up the data buffer used to read raw (encoded) data from a file.

This method is provided for client-control of the I/O buffers used by the library. Applications need never use this method; it's provided only for "intelligent clients" that wish to optimize memory usage and/or eliminate potential copy operations that can occur when working with images that have data stored without compression.

If the buffer is null, then a buffer of appropriate size is allocated by the library. Otherwise, the caller must guarantee that the buffer is large enough to hold any individual strip of raw data.

ReadCustomDirectory ( long offset, TiffFieldInfo info, int count ) : bool

Reads a custom directory from the arbitrary offset within file/stream.

ReadDirectory ( ) : bool

Reads the contents of the next TIFF directory in an open TIFF file/stream and makes it the current directory.

Directories are read sequentially.

Applications only need to call ReadDirectory to read multiple subfiles in a single TIFF file/stream - the first directory in a file/stream is automatically read when Open(string, string) or ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream) is called.

The images that have a single uncompressed strip or tile of data are automatically treated as if they were made up of multiple strips or tiles of approximately 8 kilobytes each. This operation is done only in-memory; it does not alter the contents of the file/stream. However, the construction of the "chopped strips" is visible to the application through the number of strips returned by NumberOfStrips or the number of tiles returned by NumberOfTiles.

ReadEXIFDirectory ( long offset ) : bool

Reads an EXIF directory from the given offset within file/stream.

ReadEncodedStrip ( int strip, byte buffer, int offset, int count ) : int

Reads a strip of data from an open TIFF file/stream, decompresses it and places specified amount of decompressed bytes into the user supplied buffer.

The value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

To read a full strip of data the data buffer should typically be at least as large as the number returned by StripSize. If the -1 passed in count parameter, the whole strip will be read. You should be sure you have enough space allocated for the buffer.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

ReadEncodedTile ( int tile, byte buffer, int offset, int count ) : int

Reads a tile of data from an open TIFF file/stream, decompresses it and places specified amount of decompressed bytes into the user supplied buffer.

The value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

To read a full tile of data the data buffer should typically be at least as large as the number returned by TileSize. If the -1 passed in count parameter, the whole tile will be read. You should be sure you have enough space allocated for the buffer.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

ReadRGBAImage ( int width, int height, int raster ) : bool

Reads the image and decodes it into RGBA format raster.

ReadRGBAImage reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data are placed in the lower part of the raster. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner. Please use O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImageOriented if you want to specify another raster origin.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImage converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImage is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

ReadRGBAImage ( int width, int height, int raster, bool stopOnError ) : bool

Reads the image and decodes it into RGBA format raster.

ReadRGBAImage reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data are placed in the lower part of the raster. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner. Please use O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImageOriented if you want to specify another raster origin.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImage converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImage is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

ReadRGBAImageOriented ( int width, int height, int raster, Orientation orientation ) : bool

Reads the image and decodes it into RGBA format raster using specified raster origin.

ReadRGBAImageOriented reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data placement depends on orientation. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin specified by orientation parameter.

When ReadRGBAImageOriented is used with Orientation.BOTLEFT for the orientation the produced result is the same as retuned by O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImageOriented converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImageOriented is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

ReadRGBAImageOriented ( int width, int height, int raster, Orientation orientation, bool stopOnError ) : bool

Reads the image and decodes it into RGBA format raster using specified raster origin.

ReadRGBAImageOriented reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data placement depends on orientation. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin specified by orientation parameter.

When ReadRGBAImageOriented is used with Orientation.BOTLEFT for the orientation the produced result is the same as retuned by O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImageOriented converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImageOriented is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

ReadRGBAStrip ( int row, int raster ) : bool

Reads a whole strip of a strip-based image, decodes it and converts it to RGBA format.

ReadRGBAStrip reads a single strip of a strip-based image into memory, storing the result in the user supplied RGBA raster. If specified strip is the last strip, then it will only contain the portion of the strip that is actually within the image space. The raster is assumed to be an array of width times rowsperstrip 32-bit entries, where width is the width of the image (TiffTag.IMAGEWIDTH) and rowsperstrip is the maximum lines in a strip (TiffTag.ROWSPERSTRIP).

The row value should be the row of the first row in the strip (strip * rowsperstrip, zero based).

Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner of the strip. That is bottom to top organization. When reading a partial last strip in the file the last line of the image will begin at the beginning of the buffer.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

See TiffRgbaImage for more details on how various image types are converted to RGBA values.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAStrip's main advantage over the similar O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage function is that for large images a single buffer capable of holding the whole image doesn't need to be allocated, only enough for one strip. The ReadRGBATile function does a similar operation for tiled images.

ReadRGBAStrip is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

ReadRGBATile ( int col, int row, int raster ) : bool

Reads a whole tile of a tile-based image, decodes it and converts it to RGBA format.

ReadRGBATile reads a single tile of a tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times length 32-bit entries, where width is the width of the tile (TiffTag.TILEWIDTH) and length is the height of a tile (TiffTag.TILELENGTH).

The col and row values are the offsets from the top left corner of the image to the top left corner of the tile to be read. They must be an exact multiple of the tile width and length.

Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner of the tile. That is bottom to top organization. Edge tiles which partly fall off the image will be filled out with appropriate zeroed areas.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

See TiffRgbaImage for more details on how various image types are converted to RGBA values.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBATile's main advantage over the similar O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage function is that for large images a single buffer capable of holding the whole image doesn't need to be allocated, only enough for one tile. The ReadRGBAStrip function does a similar operation for stripped images.

ReadRGBATile is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

ReadRawStrip ( int strip, byte buffer, int offset, int count ) : int

Reads the undecoded contents of a strip of data from an open TIFF file/stream and places specified amount of read bytes into the user supplied buffer.

The value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

To read a full strip of data the data buffer should typically be at least as large as the number returned by RawStripSize. If the -1 passed in count parameter, the whole strip will be read. You should be sure you have enough space allocated for the buffer.

ReadRawTile ( int tile, byte buffer, int offset, int count ) : int

Reads the undecoded contents of a tile of data from an open TIFF file/stream and places specified amount of read bytes into the user supplied buffer.

The value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

To read a full tile of data the data buffer should typically be at least as large as the number returned by RawTileSize. If the -1 passed in count parameter, the whole tile will be read. You should be sure you have enough space allocated for the buffer.

ReadScanline ( byte buffer, int row ) : bool

Reads and decodes a scanline of data from an open TIFF file/stream.

ReadScanline reads the data for the specified row into the user supplied data buffer buffer. The data are returned decompressed and, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire scanline of data. Applications should call the ScanlineSize to find out the size (in bytes) of a scanline buffer. Applications should use ReadScanline(byte[], int, short) or ReadScanline(byte[], int, int, short) and specify correct sample plane if image data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

ReadScanline ( byte buffer, int offset, int row, short plane ) : bool

Reads and decodes a scanline of data from an open TIFF file/stream.

ReadScanline reads the data for the specified row and specified sample plane plane into the user supplied data buffer buffer. The data are returned decompressed and, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire scanline of data. Applications should call the ScanlineSize to find out the size (in bytes) of a scanline buffer. Applications may use ReadScanline(byte[], int) or specify 0 for plane parameter if image data is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

ReadScanline ( byte buffer, int row, short plane ) : bool

Reads and decodes a scanline of data from an open TIFF file/stream.

ReadScanline reads the data for the specified row and specified sample plane plane into the user supplied data buffer buffer. The data are returned decompressed and, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire scanline of data. Applications should call the ScanlineSize to find out the size (in bytes) of a scanline buffer. Applications may use ReadScanline(byte[], int) or specify 0 for plane parameter if image data is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

ReadTile ( byte buffer, int offset, int x, int y, int z, short plane ) : int

Reads and decodes a tile of data from an open TIFF file/stream.

The tile to read and decode is selected by the (x, y, z, plane) coordinates (i.e. ReadTile returns the data for the tile containing the specified coordinates. The data placed in buffer are returned decompressed and, typically, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire tile of data. Applications should call the TileSize to find out the size (in bytes) of a tile buffer. The x and y parameters are always used by ReadTile. The z parameter is used if the image is deeper than 1 slice (a value of TiffTag.IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

Realloc ( byte array, int size ) : byte[]

Allocates new byte array of specified size and copies data from the existing to the new array.

Realloc ( int array, int size ) : int[]

Allocates new integer array of specified size and copies data from the existing to the new array.

Size of the array is in elements, not bytes.

RegisterCodec ( TiffCodec codec ) : void

Adds specified codec to a list of registered codec.

This method can be used to augment or override the set of codecs available to an application. If the codec is for a scheme that already has a registered codec then it is overridden and any images with data encoded with this compression scheme will be decoded using the supplied codec.

ReverseBits ( byte buffer, int count ) : void

Replaces specified number of bytes in buffer with the equivalent bit-reversed bytes.

This operation is performed with a lookup table, which can be retrieved using the GetBitRevTable method.

ReverseBits ( byte buffer, int offset, int count ) : void

Replaces specified number of bytes in buffer with the equivalent bit-reversed bytes starting at specified offset.

This operation is performed with a lookup table, which can be retrieved using the GetBitRevTable method.

RewriteDirectory ( ) : bool

Rewrites the contents of the current directory to the file and setup to create a new subfile (page) in the same file.

The RewriteDirectory operates similarly to WriteDirectory, but can be called with directories previously read or written that already have an established location in the file. It will rewrite the directory, but instead of place it at it's old location (as WriteDirectory would) it will place them at the end of the file, correcting the pointer from the preceeding directory or file header to point to it's new location. This is particularly important in cases where the size of the directory and pointed to data has grown, so it won’t fit in the space available at the old location. Note that this will result in the loss of the previously used directory space.

ScanlineSize ( ) : int

Calculates the size in bytes of a row of data as it would be returned in a call to O:BitMiracle.LibTiff.Classic.Tiff.ReadScanline, or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline.

ScanlineSize calculates size for one sample plane only. Please use RasterScanlineSize if you want to get size in bytes of a complete decoded and packed raster scanline.

SetClientInfo ( object data, string name ) : void

Associates extra information with this Tiff.

If there is already an extra information with the name specified by name it will be replaced by the information specified by data.

SetClientdata ( object data ) : object

Asscociates a custom data with this Tiff.

SetDirectory ( short number ) : bool

Sets the directory with specified number as the current directory.

SetDirectory changes the current directory and reads its contents with ReadDirectory.

SetErrorHandler ( TiffErrorHandler errorHandler ) : TiffErrorHandler

Sets an instance of the TiffErrorHandler class as custom library-wide error and warning handler.

SetField ( TiffTag tag ) : bool

Sets the value(s) of a tag in a TIFF file/stream open for writing.

SetField sets the value of a tag or pseudo-tag in the current directory associated with the open TIFF file/stream. To set the value of a field the file/stream must have been previously opened for writing with Open(string, string) or ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream); pseudo-tags can be set whether the file was opened for reading or writing. The tag is identified by tag. The type and number of values in value is dependent on the tag being set. You may want to consult "Well-known tags and their value(s) data types" to become familiar with exact data types and calling conventions required for each tag supported by the library.

A pseudo-tag is a parameter that is used to control the operation of the library but whose value is not read or written to the underlying file.

The field will be written to the file when/if the directory structure is updated.

SetFileName ( string name ) : string

Sets the new ID string for this Tiff.

Please note, that name is an arbitrary string used as ID for this Tiff. It's not required to be a file name or anything meaningful at all.

SetMode ( int mode ) : int

Sets the new mode for the underlying file or stream.

SetSubDirectory ( long offset ) : bool

Sets the directory at specified file/stream offset as the current directory.

SetSubDirectory acts like SetDirectory, except the directory is specified as a file offset instead of an index; this is required for accessing subdirectories linked through a SubIFD tag (e.g. thumbnail images).

SetTagExtender ( TiffExtendProc extender ) : TiffExtendProc

Sets the tag extender method.

Extender method is called upon creation of each instance of Tiff object.

SetTagMethods ( TiffTagMethods methods ) : TiffTagMethods

Sets the new tag methods to use.

SetWriteOffset ( long offset ) : void

Sets the current write offset.

This should only be used to set the offset to a known previous location (very carefully), or to 0 so that the next write gets appended to the end of the file.

SetupStrips ( ) : bool

Setups the strips.

ShortsToByteArray ( short source, int srcOffset, int srcCount, byte bytes, int offset ) : void

Converts array of 16-bit values into array of bytes.

StripSize ( ) : int

Computes the number of bytes in a row-aligned strip.

StripSize returns the equivalent size for a strip of data as it would be returned in a call to ReadEncodedStrip or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteEncodedStrip.

If the value of the field corresponding to TiffTag.ROWSPERSTRIP is larger than the recorded TiffTag.IMAGELENGTH, then the strip size is truncated to reflect the actual space required to hold the strip.

SwabArrayOfDouble ( double array, int count ) : void

Swaps the bytes in specified number of values in the array of double-precision floating-point numbers.

SwabArrayOfDouble ( double array, int offset, int count ) : void

Swaps the bytes in specified number of values in the array of double-precision floating-point numbers starting at specified offset.

SwabArrayOfLong ( int array, int count ) : void

Swaps the bytes in specified number of values in the array of 32-bit items.

SwabArrayOfLong ( int array, int offset, int count ) : void

Swaps the bytes in specified number of values in the array of 32-bit items starting at specified offset.

SwabArrayOfShort ( short array, int count ) : void

Swaps the bytes in specified number of values in the array of 16-bit items.

SwabArrayOfShort ( short array, int offset, int count ) : void

Swaps the bytes in specified number of values in the array of 16-bit items starting at specified offset.

SwabArrayOfTriples ( byte array, int count ) : void

Swaps the bytes in specified number of values in the array of triples (24-bit items).

SwabArrayOfTriples ( byte array, int offset, int count ) : void

Swaps the bytes in specified number of values in the array of triples (24-bit items) starting at specified offset.

SwabDouble ( double &value ) : void

Swaps the bytes in a single double-precision floating-point number.

SwabLong ( int &value ) : void

Swaps the bytes in a single 32-bit item.

SwabShort ( short &value ) : void

Swaps the bytes in a single 16-bit item.

TileRowSize ( ) : int

Compute the number of bytes in each row of a tile.

TileSize ( ) : int

Compute the number of bytes in a row-aligned tile.

TileSize returns the equivalent size for a tile of data as it would be returned in a call to ReadTile or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteTile.

UnRegisterCodec ( TiffCodec codec ) : void

Removes specified codec from a list of registered codecs.

UnlinkDirectory ( short number ) : bool

Unlinks the specified directory from the directory chain.

UnlinkDirectory does not removes directory bytes from the file/stream. It only makes them unused.

VStripSize ( int rowCount ) : int

Computes the number of bytes in a row-aligned strip with specified number of rows.

VTileSize ( int rowCount ) : int

Computes the number of bytes in a row-aligned tile with specified number of rows.

Warning ( Tiff tif, string method, string format ) : void

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

Warning ( string method, string format ) : void

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

WarningExt ( Tiff tif, object clientData, string method, string format ) : void

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error and passes client data to the warning handler.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the warning handler. Default warning handler does not use it. Only custom warning handlers may make use of it.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

WarningExt ( object clientData, string method, string format ) : void

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error and passes client data to the warning handler.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the warning handler. Default warning handler does not use it. Only custom warning handlers may make use of it.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

WriteBufferSetup ( byte buffer, int size ) : void

Sets up the data buffer used to write raw (encoded) data to a file.

This method is provided for client-control of the I/O buffers used by the library. Applications need never use this method; it's provided only for "intelligent clients" that wish to optimize memory usage and/or eliminate potential copy operations that can occur when working with images that have data stored without compression.

If the size is -1 then the buffer size is selected to hold a complete tile or strip, or at least 8 kilobytes, whichever is greater. If the buffer is null, then a buffer of appropriate size is allocated by the library.

WriteCheck ( bool tiles, string method ) : bool

Verifies that file/stream is writable and that the directory information is setup properly.

WriteDirectory ( ) : bool

Writes the contents of the current directory to the file and setup to create a new subfile (page) in the same file.

Applications only need to call WriteDirectory when writing multiple subfiles (pages) to a single TIFF file. WriteDirectory is automatically called by Close and Flush to write a modified directory if the file is open for writing.

WriteEncodedStrip ( int strip, byte buffer, int count ) : int

Encodes and writes a strip of data to an open TIFF file/stream.

WriteEncodedStrip encodes count bytes of raw data from buffer and append the result to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

WriteEncodedStrip ( int strip, byte buffer, int offset, int count ) : int

Encodes and writes a strip of data to an open TIFF file/stream.

WriteEncodedStrip encodes count bytes of raw data from buffer and append the result to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

WriteEncodedTile ( int tile, byte buffer, int count ) : int

Encodes and writes a tile of data to an open TIFF file/stream.

WriteEncodedTile encodes count bytes of raw data from buffer and append the result to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteEncodedTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

WriteEncodedTile ( int tile, byte buffer, int offset, int count ) : int

Encodes and writes a tile of data to an open TIFF file/stream.

WriteEncodedTile encodes count bytes of raw data from buffer and append the result to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteEncodedTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

WriteRawStrip ( int strip, byte buffer, int count ) : int

Writes a strip of raw data to an open TIFF file/stream.

WriteRawStrip appends count bytes of raw data from buffer to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

WriteRawStrip ( int strip, byte buffer, int offset, int count ) : int

Writes a strip of raw data to an open TIFF file/stream.

WriteRawStrip appends count bytes of raw data from buffer to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

WriteRawTile ( int tile, byte buffer, int count ) : int

Writes a tile of raw data to an open TIFF file/stream.

WriteRawTile appends count bytes of raw data to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteRawTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

WriteRawTile ( int tile, byte buffer, int offset, int count ) : int

Writes a tile of raw data to an open TIFF file/stream.

WriteRawTile appends count bytes of raw data to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteRawTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

WriteScanline ( byte buffer, int row ) : bool

Encodes and writes a scanline of data to an open TIFF file/stream.

WriteScanline encodes and writes to a file at the specified row. Applications should use WriteScanline(byte[], int, short) or WriteScanline(byte[], int, int, short) and specify correct sample plane parameter if image data in a file/stream is organized in separate planes (i.e TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the scanline (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.

Once data are written to a file/stream for the current directory, the values of certain tags may not be altered; see "Well-known tags and their value(s) data types" for more information.

It is not possible to write scanlines to a file/stream that uses a tiled organization. The IsTiled can be used to determine if the file/stream is organized as tiles or strips.

WriteScanline ( byte buffer, int offset, int row, short plane ) : bool

Encodes and writes a scanline of data to an open TIFF file/stream.

WriteScanline encodes and writes to a file at the specified row and specified sample plane plane. Applications may use WriteScanline(byte[], int) or specify 0 for plane parameter if image data in a file/stream is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the scanline (except for TiffTag.PLANARCONFIG = PlanarConfig.CONTIG, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.

Once data are written to a file/stream for the current directory, the values of certain tags may not be altered; see "Well-known tags and their value(s) data types" for more information.

It is not possible to write scanlines to a file/stream that uses a tiled organization. The IsTiled can be used to determine if the file/stream is organized as tiles or strips.

WriteScanline ( byte buffer, int row, short plane ) : bool

Encodes and writes a scanline of data to an open TIFF file/stream.

WriteScanline encodes and writes to a file at the specified row and specified sample plane plane. Applications may use WriteScanline(byte[], int) or specify 0 for plane parameter if image data in a file/stream is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the scanline (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.

Once data are written to a file/stream for the current directory, the values of certain tags may not be altered; see "Well-known tags and their value(s) data types" for more information.

It is not possible to write scanlines to a file/stream that uses a tiled organization. The IsTiled can be used to determine if the file/stream is organized as tiles or strips.

WriteTile ( byte buffer, int offset, int x, int y, int z, short plane ) : int

Encodes and writes a tile of data to an open TIFF file/stream.

The tile to place encoded data is selected by the (x, y, z, plane) coordinates (i.e. WriteTile writes data to the tile containing the specified coordinates. WriteTile (potentially) encodes the data buffer and writes it to open file/stream. The buffer must contain an entire tile of data. Applications should call the TileSize to find out the size (in bytes) of a tile buffer. The x and y parameters are always used by WriteTile. The z parameter is used if the image is deeper than 1 slice (a value of TiffTag.IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

WriteTile ( byte buffer, int x, int y, int z, short plane ) : int

Encodes and writes a tile of data to an open TIFF file/stream.

The tile to place encoded data is selected by the (x, y, z, plane) coordinates (i.e. WriteTile writes data to the tile containing the specified coordinates. WriteTile (potentially) encodes the data buffer and writes it to open file/stream. The buffer must contain an entire tile of data. Applications should call the TileSize to find out the size (in bytes) of a tile buffer. The x and y parameters are always used by WriteTile. The z parameter is used if the image is deeper than 1 slice (a value of TiffTag.IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

Private Methods

Method Description
BITn ( int n ) : int
advanceDirectory ( uint &nextdir, long &off ) : bool
appendToStrip ( int strip, byte buffer, int offset, int count ) : bool

Appends the data to the specified strip.

bufferCheck ( ) : void
byteCountLooksBad ( TiffDirectory td ) : bool
checkDirCount ( TiffDirEntry dir, int count ) : bool
checkDirOffset ( uint diroff ) : bool

Checks the directory offset against the list of already seen directory offsets.

This is a trick to prevent IFD looping. The one can create TIFF file with looped directory pointers. We will maintain a list of already seen directories and check every IFD offset against that list.

checkRead ( bool tiles ) : bool
chopUpSingleUncompressedStrip ( ) : void

Replace a single strip (tile) of uncompressed data with multiple strips (tiles), each approximately 8Kbytes.

This is useful for dealing with large images or for dealing with machines with a limited amount of memory.

clearFieldBit ( int field ) : void
createAnonFieldInfo ( TiffTag tag, TiffType field_type ) : TiffFieldInfo
cvtRational ( TiffDirEntry dir, int num, int denom, float &rv ) : bool
dataSize ( TiffType type ) : int
defaultRefBlackWhite ( TiffDirectory td ) : void
defaultTransferFunction ( TiffDirectory td ) : bool
encodeOctalString ( byte value ) : string
estimateStripByteCounts ( TiffDirEntry dir, short dircount ) : bool
extractData ( TiffDirEntry dir ) : int
fetchAnyArray ( TiffDirEntry dir, double v ) : bool

Fetches an array of ANY values.

The actual values are returned as doubles which should be able hold all the types. Note in particular that we assume that the double return value vector is large enough to read in any fundamental type. We use that vector as a buffer to read in the base type vector and then convert it in place to double (from end to front of course).

fetchByteArray ( TiffDirEntry dir, byte v ) : bool

Fetches an array of BYTE or SBYTE values.

fetchData ( TiffDirEntry dir, byte buffer ) : int

Fetches a contiguous directory item.

fetchDirectory ( uint diroff, TiffDirEntry &pdir, uint &nextdiroff ) : short

Reads IFD structure from the specified offset.

fetchDoubleArray ( TiffDirEntry dir, double v ) : bool

Fetches an array of DOUBLE values.

fetchFailed ( TiffDirEntry dir ) : int
fetchFloat ( TiffDirEntry dir ) : float

Fetch a single floating point value from the offset field and return it as a native float.

fetchFloatArray ( TiffDirEntry dir, float v ) : bool

Fetches an array of FLOAT values.

fetchLongArray ( TiffDirEntry dir, int v ) : bool

Fetches an array of LONG or SLONG values.

fetchNormalTag ( TiffDirEntry dir ) : bool

Fetches a tag that is not handled by special case code.

fetchPerSampleAnys ( TiffDirEntry dir, double &pl ) : bool

Fetches samples/pixel ANY values for the specified tag and verify that all values are the same.

fetchPerSampleLongs ( TiffDirEntry dir, int &pl ) : bool

Fetches samples/pixel long values for the specified tag and verify that all values are the same.

fetchPerSampleShorts ( TiffDirEntry dir, short &pl ) : bool

Fetches samples/pixel short values for the specified tag and verify that all values are the same.

fetchRational ( TiffDirEntry dir ) : float
fetchRationalArray ( TiffDirEntry dir, float v ) : bool

Fetch an array of RATIONAL or SRATIONAL values.

fetchRefBlackWhite ( TiffDirEntry dir ) : bool

Fetches and sets the RefBlackWhite tag.

fetchShortArray ( TiffDirEntry dir, short v ) : bool

Fetch an array of SHORT or SSHORT values.

fetchShortPair ( TiffDirEntry dir ) : bool
fetchString ( TiffDirEntry dir, string &cp ) : int

Fetches an ASCII item from the file.

fetchStripThing ( TiffDirEntry dir, int nstrips, int &lpp ) : bool

Fetches a set of offsets or lengths.

While this routine says "strips", in fact it's also used for tiles.

fetchStripThing ( TiffDirEntry dir, int nstrips, uint &lpp ) : bool
fetchSubjectDistance ( TiffDirEntry dir ) : bool
fieldSet ( int field ) : bool
fieldSet ( int fields, short f ) : bool
fillStrip ( int strip ) : bool

Read the specified strip and setup for decoding. The data buffer is expanded, as necessary, to hold the strip's data.

fillTile ( int tile ) : bool

Read the specified tile and setup for decoding. The data buffer is expanded, as necessary, to hold the tile's data.

flushData1 ( ) : bool
fprintf ( Stream fd, string format ) : void
getExifFieldInfo ( int &size ) : TiffFieldInfo[]
getFieldInfo ( int &size ) : TiffFieldInfo[]
getFileSize ( ) : long
getMode ( string mode, string module, FileMode &m, FileAccess &a ) : int
growStrips ( int delta ) : bool
howMany ( int x, int y ) : int
howMany ( uint x, uint y ) : uint
howMany8 ( int x ) : int
initOrder ( int magic ) : void
insertData ( TiffType type, int v ) : uint
isFillOrder ( FillOrder o ) : bool
isPseudoTag ( TiffTag t ) : bool
isUnspecified ( int f ) : bool
linkDirectory ( ) : bool

Link the current directory into the directory chain for the file.

missingRequired ( string tagname ) : void
multiply ( int nmemb, int elem_size, string where ) : int
newScanlineSize ( ) : int
okToChangeTag ( TiffTag tag ) : bool
oldScanlineSize ( ) : int
prettyPrintField ( Stream fd, TiffTag tag, int value_count, object raw_data ) : bool
printAscii ( Stream fd, string cp ) : void
printField ( Stream fd, TiffFieldInfo fip, int value_count, object raw_data ) : void
readDirEntry ( TiffDirEntry dir, short dircount, byte bytes, int offset ) : void
readDirEntryOk ( TiffDirEntry dir, short dircount ) : bool
readDirectoryFind ( TiffDirEntry dir, short dircount, TiffTag tagid ) : int
readFile ( byte buf, int offset, int size ) : int
readHeaderOk ( TiffHeader &header ) : bool
readInt ( byte buffer, int offset ) : int
readIntOK ( int &value ) : bool
readOK ( byte buf, int size ) : bool
readRawStrip1 ( int strip, byte buf, int offset, int size, string module ) : int
readRawTile1 ( int tile, byte buf, int offset, int size, string module ) : int
readShort ( byte buffer, int offset ) : short
readShortOK ( short &value ) : bool
readUIntOK ( uint &value ) : bool
resetFieldBit ( int fields, short f ) : void
roundUp ( int x, int y ) : int
sampleToTagType ( ) : TiffType
seek ( int row, short sample ) : bool
seekFile ( long off, SeekOrigin whence ) : long
seekOK ( long off ) : bool
setFieldBit ( int field ) : void
setFloatArray ( float &fpp, float fp, int n ) : void
setLongArray ( int &lpp, int lp, int n ) : void
setShortArray ( short &wpp, short wp, int n ) : void
setString ( string &cpp, string cp ) : void
setupBuiltInCodecs ( ) : void

Compression schemes statically built into the library.

setupDefaultDirectory ( ) : void
setupFieldInfo ( TiffFieldInfo info, int n ) : void
setupShort ( TiffTag tag, TiffDirEntry &dir, short v ) : void

Setups a SHORT directory entry

setupShortLong ( TiffTag tag, TiffDirEntry &dir, int v ) : void

Setups a directory entry with either a SHORT or LONG type according to the value.

setupShortPair ( TiffTag tag, TiffDirEntry &dir ) : bool
startStrip ( int strip ) : bool

Set state to appear as if a strip has just been read in.

startTile ( int tile ) : bool
summarize ( int summand1, int summand2, string where ) : int
swab16BitData ( byte buffer, int offset, int count ) : void
swab24BitData ( byte buffer, int offset, int count ) : void
swab32BitData ( byte buffer, int offset, int count ) : void
swab64BitData ( byte buffer, int offset, int count ) : void
writeAnyArray ( TiffType type, TiffTag tag, TiffDirEntry &dir, int n, double v ) : bool

Writes an array of "type" values for a specified tag (i.e. this is a tag which is allowed to have different types, e.g. SMaxSampleType). Internally the data values are represented as double since a double can hold any of the TIFF tag types (yes, this should really be an abstract type tany_t for portability). The data is converted into the specified type in a temporary buffer and then handed off to the appropriate array writer.

writeByteArray ( TiffDirEntry &dir, byte cp ) : bool

Write/copy data associated with an ASCII or opaque tag value.

writeCheckStrips ( string module ) : bool
writeCheckTiles ( string module ) : bool
writeData ( TiffDirEntry &dir, byte buffer, int count ) : bool

Writes a contiguous directory item.

writeData ( TiffDirEntry &dir, double buffer, int count ) : bool
writeData ( TiffDirEntry &dir, float cp, int cc ) : bool
writeData ( TiffDirEntry &dir, int cp, int cc ) : bool
writeData ( TiffDirEntry &dir, short buffer, int count ) : bool
writeDirEntryOK ( TiffDirEntry entries, int count ) : bool
writeDirectory ( bool done ) : bool

Writes the contents of the current directory to the specified file.

This routine doesn't handle overwriting a directory with auxiliary storage that's been changed.

writeDoubleArray ( TiffDirEntry &dir, double v ) : bool
writeFloatArray ( TiffDirEntry &dir, float v ) : bool
writeHeaderOK ( TiffHeader header ) : bool
writeInkNames ( TiffDirEntry &dir ) : bool
writeInt ( int value, byte buffer, int offset ) : void
writeIntOK ( int value ) : bool
writeLongArray ( TiffDirEntry &dir, int v ) : bool

Setup a directory entry of an array of LONG or SLONG and write the associated indirect values.

writeLongArray ( TiffDirEntry &dir, uint v ) : bool
writeNormalTag ( TiffDirEntry &dir, TiffFieldInfo fip ) : bool

Writes tags that are not special cased.

writeOK ( byte buffer, int offset, int count ) : bool
writePerSampleAnys ( TiffType type, TiffTag tag, TiffDirEntry &dir ) : bool
writePerSampleShorts ( TiffTag tag, TiffDirEntry &dir ) : bool
writeRational ( TiffType type, TiffTag tag, TiffDirEntry &dir, float v ) : bool
writeRationalArray ( TiffDirEntry &dir, float v ) : bool

Setup a directory entry of an array of RATIONAL or SRATIONAL and write the associated indirect values.

writeRationalPair ( TiffDirEntry entries, int dirOffset, TiffType type, TiffTag tag1, float v1, TiffTag tag2, float v2 ) : bool
writeShortArray ( TiffDirEntry &dir, short v ) : bool

Setup a directory entry of an array of SHORT or SSHORT and write the associated indirect values.

writeShortOK ( short value ) : bool
writeShortTable ( TiffTag tag, TiffDirEntry &dir, int n, short table ) : bool

Setup a directory entry for an NxM table of shorts, where M is known to be 2**bitspersample, and write the associated indirect data.

writeTransferFunction ( TiffDirEntry &dir ) : bool

Method Details

ByteArrayToInts() public static method

Converts a byte buffer into array of 32-bit values.
public static ByteArrayToInts ( byte buffer, int offset, int count ) : int[]
buffer byte The byte buffer.
offset int The zero-based offset in at /// which to begin converting bytes.
count int The number of bytes to convert.
return int[]

ByteArrayToShorts() public static method

Converts a byte buffer into array of 16-bit values.
public static ByteArrayToShorts ( byte buffer, int offset, int count ) : short[]
buffer byte The byte buffer.
offset int The zero-based offset in at /// which to begin converting bytes.
count int The number of bytes to convert.
return short[]

CheckTile() public method

Checks whether the specified (x, y, z, plane) coordinates are within the bounds of the image.
The x parameter is checked against the value of the TiffTag.IMAGEWIDTH tag. The y parameter is checked against the value of the TiffTag.IMAGELENGTH tag. The z parameter is checked against the value of the TiffTag.IMAGEDEPTH tag (if defined). The plane parameter is checked against the value of the TiffTag.SAMPLESPERPIXEL tag if the data are organized in separate planes.
public CheckTile ( int x, int y, int z, short plane ) : bool
x int The x-coordinate.
y int The y-coordinate.
z int The z-coordinate.
plane short The sample plane.
return bool

CheckpointDirectory() public method

Writes the current state of the TIFF directory into the file to make what is currently in the file/stream readable.
Unlike WriteDirectory, CheckpointDirectory does not free up the directory data structures in memory, so they can be updated (as strips/tiles are written) and written again. Reading such a partial file you will at worst get a TIFF read error for the first strip/tile encountered that is incomplete, but you will at least get all the valid data in the file before that. When the file is complete, just use WriteDirectory as usual to finish it off cleanly.
public CheckpointDirectory ( ) : bool
return bool

ClientOpen() public static method

Initializes new instance of Tiff class and opens a stream with TIFF data for reading or writing.

This method can be used to read TIFF data from sources other than file. When custom stream class derived from TiffStream is used it is possible to read (or write) TIFF data that reside in memory, database, etc.

Please note, that name is an arbitrary string used as ID for the created Tiff. It's not required to be a file name or anything meaningful at all.

Please read remarks for Open(string, string) method for the list of option flags that can be specified in mode parameter.

public static ClientOpen ( string name, string mode, object clientData, TiffStream stream ) : Tiff
name string The name for the new instance of class.
mode string The open mode. Specifies if the file is to be opened for /// reading ("r"), writing ("w"), or appending ("a") and, optionally, whether to override /// certain default aspects of library operation (see remarks for /// method for the list of the mode flags).
clientData object Some client data. This data is passed as parameter to every /// method of the object specified by the /// parameter.
stream TiffStream An instance of the class to use for /// reading, writing and seeking of TIFF data.
return Tiff

Clientdata() public method

Returns the custom client data associated with this Tiff.
public Clientdata ( ) : object
return object

Close() public method

Closes a previously opened TIFF file.
This method closes a file or stream that was previously opened with Open(string, string) or ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream). Any buffered data are flushed to the file/stream, including the contents of the current directory (if modified); and all resources are reclaimed.
public Close ( ) : void
return void

Compare() public static method

Compares specified number of elements in two arrays.
public static Compare ( short first, short second, int elementCount ) : int
first short The first array to compare.
second short The second array to compare.
elementCount int The number of elements to compare.
return int

ComputeStrip() public method

Computes which strip contains the specified coordinates (row, plane).
A valid strip number is always returned; out-of-range coordinate values are clamped to the bounds of the image. The row parameter is always used in calculating a strip. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).
public ComputeStrip ( int row, short plane ) : int
row int The row.
plane short The sample plane.
return int

ComputeTile() public method

Computes which tile contains the specified coordinates (x, y, z, plane).
A valid tile number is always returned; out-of-range coordinate values are clamped to the bounds of the image. The x and y parameters are always used in calculating a tile. The z parameter is used if the image is deeper than 1 slice (TiffTag.IMAGEDEPTH > 1). The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).
public ComputeTile ( int x, int y, int z, short plane ) : int
x int The x-coordinate.
y int The y-coordinate.
z int The z-coordinate.
plane short The sample plane.
return int

CreateDirectory() public method

Creates a new directory within file/stream.
The newly created directory will not exist on the file/stream till WriteDirectory, CheckpointDirectory, Flush or Close is called.
public CreateDirectory ( ) : void
return void

CurrentDirOffset() public method

Retrieves the file/stream offset of the current directory.
public CurrentDirOffset ( ) : long
return long

CurrentDirectory() public method

Gets the zero-based index of the current directory.
The zero-based index returned by this method is suitable for use with the SetDirectory method.
public CurrentDirectory ( ) : short
return short

CurrentRow() public method

Gets the current row that is being read or written.
The current row is updated each time a read or write is done.
public CurrentRow ( ) : int
return int

CurrentStrip() public method

Gets the current strip that is being read or written.
The current strip is updated each time a read or write is done.
public CurrentStrip ( ) : int
return int

CurrentTile() public method

Gets the current tile that is being read or written.
The current tile is updated each time a read or write is done.
public CurrentTile ( ) : int
return int

DataWidth() public static method

Gets the number of bytes occupied by the item of given type.
public static DataWidth ( TiffType type ) : int
type TiffType The type.
return int

DefaultStripSize() public method

Computes the number of rows for a reasonable-sized strip according to the current settings of the TiffTag.IMAGEWIDTH, TiffTag.BITSPERSAMPLE and TiffTag.SAMPLESPERPIXEL tags and any compression-specific requirements.
If the estimate parameter is non-zero, then it is taken as an estimate of the desired strip size and adjusted according to any compression-specific requirements. The value returned by DefaultStripSize is typically used to define the TiffTag.ROWSPERSTRIP tag. If there is no any unusual requirements DefaultStripSize tries to create strips that have approximately 8 kilobytes of uncompressed data.
public DefaultStripSize ( int estimate ) : int
estimate int The esimated value (may be zero).
return int

DefaultTileSize() public method

Computes the pixel width and height of a reasonable-sized tile suitable for setting up the TiffTag.TILEWIDTH and TiffTag.TILELENGTH tags.
If the width and height values passed in are non-zero, then they are adjusted to reflect any compression-specific requirements. The returned width and height are constrained to be a multiple of 16 pixels to conform with the TIFF specification.
public DefaultTileSize ( int &width, int &height ) : void
width int The proposed tile width upon the call / tile width to use /// after the call.
height int The proposed tile height upon the call / tile height to use /// after the call.
return void

Dispose() public method

Frees and releases all resources allocated by this Tiff.
public Dispose ( ) : void
return void

Error() public static method

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

public static Error ( Tiff tif, string method, string format ) : void
tif Tiff An instance of the class. Can be null.
method string The method where an error is detected.
format string A composite format string (see Remarks).
return void

Error() public static method

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

public static Error ( string method, string format ) : void
method string The method where an error is detected.
format string A composite format string (see Remarks).
return void

ErrorExt() public static method

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the error handler. Default error handler does not use it. Only custom error handlers may make use of it.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

public static ErrorExt ( Tiff tif, object clientData, string method, string format ) : void
tif Tiff An instance of the class. Can be null.
clientData object The client data to be passed to error handler.
method string The method where an error is detected.
format string A composite format string (see Remarks).
return void

ErrorExt() public static method

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the error handler. Default error handler does not use it. Only custom error handlers may make use of it.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

public static ErrorExt ( object clientData, string method, string format ) : void
clientData object The client data to be passed to error handler.
method string The method where an error is detected.
format string A composite format string (see Remarks).
return void

FieldWithName() public method

Retrieves field information for the tag with specified name.
public FieldWithName ( string name ) : TiffFieldInfo
name string The name of the tag to retrieve field information for.
return TiffFieldInfo

FieldWithTag() public method

Retrieves field information for the specified tag.
public FieldWithTag ( TiffTag tag ) : TiffFieldInfo
tag TiffTag The tag to retrieve field information for.
return TiffFieldInfo

FileName() public method

Gets the name of the file or ID string for this Tiff.
If this Tiff was created using Open(string, string) method then value of fileName parameter of Open(string, string) method is returned. If this Tiff was created using ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream) then value of name parameter of ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream) method is returned.
public FileName ( ) : string
return string

FindCodec() public method

Retrieves the codec registered for the specified compression scheme.

LibTiff.Net supports a variety of compression schemes implemented by software codecs. Each codec adheres to a modular interface that provides for the decoding and encoding of image data; as well as some other methods for initialization, setup, cleanup, and the control of default strip and tile sizes. Codecs are identified by the associated value of the TiffTag.COMPRESSION tag.

Other compression schemes may be registered. Registered schemes can also override the built-in versions provided by the library.

public FindCodec ( Compression scheme ) : TiffCodec
scheme Compression The compression scheme.
return TiffCodec

FindFieldInfo() public method

Retrieves field information for the specified tag.
public FindFieldInfo ( TiffTag tag, TiffType type ) : TiffFieldInfo
tag TiffTag The tag to retrieve field information for.
type TiffType The tiff data type to use us additional filter.
return TiffFieldInfo

FindFieldInfoByName() public method

Retrieves field information for the tag with specified name.
public FindFieldInfoByName ( string name, TiffType type ) : TiffFieldInfo
name string The name of the tag to retrieve field information for.
type TiffType The tiff data type to use us additional filter.
return TiffFieldInfo

Flush() public method

Flushes pending writes to an open TIFF file.
Flush causes any pending writes for the specified file (including writes for the current directory) to be done. In normal operation this call is never needed − the library automatically does any flushing required.
public Flush ( ) : bool
return bool

FlushData() public method

Flushes any pending image data for the specified file to be written out.
FlushData flushes any pending image data for the specified file to be written out; directory-related data are not flushed. In normal operation this call is never needed − the library automatically does any flushing required.
public FlushData ( ) : bool
return bool

FreeDirectory() public method

Releases storage associated with current directory.
public FreeDirectory ( ) : void
return void

GetA() public static method

Gets the A component from ABGR value returned by ReadRGBAImage.
public static GetA ( int abgr ) : int
abgr int The ABGR value.
return int

GetB() public static method

Gets the B component from ABGR value returned by ReadRGBAImage.
public static GetB ( int abgr ) : int
abgr int The ABGR value.
return int

GetBitRevTable() public static method

Retrieves a bit reversal table.
If reversed is false then the table that do not reverse bit values will be retrieved. It is a lookup table that can be used as an identity function; i.e. NoBitRevTable[n] == n.
public static GetBitRevTable ( bool reversed ) : byte[]
reversed bool if set to true then bit reversal table will be /// retrieved; otherwise, the table that do not reverse bit values will be retrieved.
return byte[]

GetClientInfo() public method

Gets the extra information with specified name associated with this Tiff.
public GetClientInfo ( string name ) : object
name string Name of the extra information to retrieve.
return object

GetConfiguredCodecs() public method

Retrieves an array of configured codecs, both built-in and registered by user.
public GetConfiguredCodecs ( ) : BitMiracle.LibTiff.Classic.TiffCodec[]
return BitMiracle.LibTiff.Classic.TiffCodec[]

GetField() public method

Gets the value(s) of a tag in an open TIFF file.

GetField returns the value(s) of a tag or pseudo-tag associated with the current directory of the opened TIFF file. The tag is identified by tag. The type and number of values returned is dependent on the tag being requested. You may want to consult "Well-known tags and their value(s) data types" to become familiar with exact data types and calling conventions required for each tag supported by the library.

A pseudo-tag is a parameter that is used to control the operation of the library but whose value is not read or written to the underlying file.

public GetField ( TiffTag tag ) : BitMiracle.LibTiff.Classic.FieldValue[]
tag TiffTag The tag.
return BitMiracle.LibTiff.Classic.FieldValue[]

GetFieldDefaulted() public method

Gets the value(s) of a tag in an open TIFF file or default value(s) of a tag if a tag is not defined in the current directory and it has a default value(s).

GetFieldDefaulted returns the value(s) of a tag or pseudo-tag associated with the current directory of the opened TIFF file or default value(s) of a tag if a tag is not defined in the current directory and it has a default value(s). The tag is identified by tag. The type and number of values returned is dependent on the tag being requested. You may want to consult "Well-known tags and their value(s) data types" to become familiar with exact data types and calling conventions required for each tag supported by the library.

A pseudo-tag is a parameter that is used to control the operation of the library but whose value is not read or written to the underlying file.

public GetFieldDefaulted ( TiffTag tag ) : BitMiracle.LibTiff.Classic.FieldValue[]
tag TiffTag The tag.
return BitMiracle.LibTiff.Classic.FieldValue[]

GetG() public static method

Gets the G component from ABGR value returned by ReadRGBAImage.
public static GetG ( int abgr ) : int
abgr int The ABGR value.
return int

GetMode() public method

Gets the mode with which the underlying file or stream was opened.
public GetMode ( ) : int
return int

GetR() public static method

Gets the R component from ABGR value returned by ReadRGBAImage.
public static GetR ( int abgr ) : int
abgr int The ABGR value.
return int

GetStream() public method

Gets the tiff stream.
public GetStream ( ) : TiffStream
return TiffStream

GetTagListCount() public method

Gets the number of elements in the custom tag list.
public GetTagListCount ( ) : int
return int

GetTagListEntry() public method

Retrieves the custom tag with specified index.
public GetTagListEntry ( int index ) : int
index int The zero-based index of a custom tag to retrieve.
return int

GetTagMethods() public method

Gets the currently used tag methods.
public GetTagMethods ( ) : TiffTagMethods
return TiffTagMethods

GetVersion() public static method

Gets the library version string.
public static GetVersion ( ) : string
return string

IntsToByteArray() public static method

Converts array of 32-bit values into array of bytes.
public static IntsToByteArray ( int source, int srcOffset, int srcCount, byte bytes, int offset ) : void
source int The array of 32-bit values.
srcOffset int The zero-based offset in at /// which to begin converting bytes.
srcCount int The number of 32-bit values to convert.
bytes byte The byte array to store converted values at.
offset int The zero-based offset in at /// which to begin storing converted values.
return void

IsBigEndian() public method

Gets the value indicating whether given image data was written in big-endian order.
public IsBigEndian ( ) : bool
return bool

IsByteSwapped() public method

Gets the value indicating whether the image data was in a different byte-order than the host computer.

Note that ReadTile, ReadEncodedTile, ReadEncodedStrip and O:BitMiracle.LibTiff.Classic.Tiff.ReadScanline methods already normally perform byte swapping to local host order if needed.

Also note that ReadRawTile and ReadRawStrip do not perform byte swapping to local host order.

public IsByteSwapped ( ) : bool
return bool

IsCodecConfigured() public method

Checks whether library has working codec for the specific compression scheme.
public IsCodecConfigured ( Compression scheme ) : bool
scheme Compression The scheme to check.
return bool

IsMSB2LSB() public method

Gets the value indicating whether the image data is being returned in MSB-to-LSB bit order.
public IsMSB2LSB ( ) : bool
return bool

IsTiled() public method

Gets the value indicating whether the image data of this Tiff has a tiled organization.
public IsTiled ( ) : bool
return bool

IsUpSampled() public method

Gets the value indicating whether the image data returned through the read interface methods is being up-sampled.
The value returned by this method can be useful to applications that want to calculate I/O buffer sizes to reflect this usage (though the usual strip and tile size routines already do this).
public IsUpSampled ( ) : bool
return bool

LastDirectory() public method

Returns an indication of whether the current directory is the last directory in the file.
public LastDirectory ( ) : bool
return bool

MergeFieldInfo() public method

Merges given field information to existing one.
public MergeFieldInfo ( TiffFieldInfo info, int count ) : void
info TiffFieldInfo The array of objects.
count int The number of items to use from the array.
return void

NumberOfDirectories() public method

Gets the number of directories in a file.
public NumberOfDirectories ( ) : short
return short

NumberOfStrips() public method

Retrives the number of strips in the image.
public NumberOfStrips ( ) : int
return int

NumberOfTiles() public method

Retrives the number of tiles in the image.
public NumberOfTiles ( ) : int
return int

Open() public static method

Initializes new instance of Tiff class and opens a TIFF file for reading or writing.

Open(string, string) opens a TIFF file whose name is fileName. When a file is opened for appending, existing data will not be touched; instead new data will be written as additional subfiles. If an existing file is opened for writing, all previous data is overwritten.

If a file is opened for reading, the first TIFF directory in the file is automatically read (see SetDirectory for reading directories other than the first). If a file is opened for writing or appending, a default directory is automatically created for writing subsequent data. This directory has all the default values specified in TIFF Revision 6.0: BitsPerSample = 1, ThreshHolding = Threshold.BILEVEL (bilevel art scan), FillOrder = MSB2LSB (most significant bit of each data byte is filled first), Orientation = TOPLEFT (the 0th row represents the visual top of the image, and the 0th column represents the visual left hand side), SamplesPerPixel = 1, RowsPerStrip = infinity, ResolutionUnit = INCH, and Compression = NONE. To alter these values, or to define values for additional fields, SetField must be used.

The mode parameter can include the following flags in addition to the "r", "w", and "a" flags. Note however that option flags must follow the read-write-append specification.

FlagDescription l When creating a new file force information be written with Little-Endian byte order (but see below). b When creating a new file force information be written with Big-Endian byte order (but see below). L Force image data that is read or written to be treated with bits filled from Least Significant Bit (LSB) to Most Significant Bit (MSB). Note that this is the opposite to the way the library has worked from its inception. B Force image data that is read or written to be treated with bits filled from Most Significant Bit (MSB) to Least Significant Bit (LSB); this is the default. H Force image data that is read or written to be treated with bits filled in the same order as the native CPU. C Enable the use of "strip chopping" when reading images that are comprised of a single strip or tile of uncompressed data. Strip chopping is a mechanism by which the library will automatically convert the single-strip image to multiple strips, each of which has about 8 Kilobytes of data. This facility can be useful in reducing the amount of memory used to read an image because the library normally reads each strip in its entirety. Strip chopping does however alter the apparent contents of the image because when an image is divided into multiple strips it looks as though the underlying file contains multiple separate strips. The default behaviour is to enable strip chopping. c Disable the use of strip chopping when reading images. h Read TIFF header only, do not load the first image directory. That could be useful in case of the broken first directory. We can open the file and proceed to the other directories.

By default the library will create new files with the native byte-order of the CPU on which the application is run. This ensures optimal performance and is portable to any application that conforms to the TIFF specification. To force the library to use a specific byte-order when creating a new file the "b" and "l" option flags may be included in the mode parameter; for example, "wb" or "wl".

The use of the "l" and "b" flags is strongly discouraged. These flags are provided solely because numerous vendors do not correctly support TIFF; they only support one of the two byte orders. It is strongly recommended that you not use this feature except to deal with busted apps that write invalid TIFF.

The "L", "B", and "H" flags are intended for applications that can optimize operations on data by using a particular bit order. By default the library returns data in MSB2LSB bit order. Returning data in the bit order of the native CPU makes the most sense but also requires applications to check the value of the TiffTag.FILLORDER tag; something they probably do not do right now.

The "c" option permits applications that only want to look at the tags, for example, to get the unadulterated TIFF tag information.

public static Open ( string fileName, string mode ) : Tiff
fileName string The name of the file to open.
mode string The open mode. Specifies if the file is to be opened for /// reading ("r"), writing ("w"), or appending ("a") and, optionally, whether to override /// certain default aspects of library operation (see remarks).
return Tiff

PrintDirectory() public method

Prints formatted description of the contents of the current directory to the specified stream.
public PrintDirectory ( Stream stream ) : void
stream Stream The stream.
return void

PrintDirectory() public method

Prints formatted description of the contents of the current directory to the specified stream using specified print (formatting) options.
public PrintDirectory ( Stream stream, TiffPrintFlags flags ) : void
stream Stream The stream.
flags TiffPrintFlags The print (formatting) options.
return void

RGBAImageOK() public method

Check the image to see if it can be converted to RGBA format.

To convert the image to RGBA format please use O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage, O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImageOriented, ReadRGBAStrip or ReadRGBATile

Convertible images should follow this rules: samples must be either 1, 2, 4, 8, or 16 bits; colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

public RGBAImageOK ( string &errorMsg ) : bool
errorMsg string The error message (if any) gets placed here.
return bool

RasterScanlineSize() public method

Calculates the size in bytes of a complete decoded and packed raster scanline.
The value returned by RasterScanlineSize may be different from the value returned by ScanlineSize if data is stored as separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).
public RasterScanlineSize ( ) : int
return int

RawStripSize() public method

Computes the number of bytes in a raw (i.e. not decoded) strip.
public RawStripSize ( int strip ) : long
strip int The zero-based index of a strip.
return long

RawTileSize() public method

Computes the number of bytes in a raw (i.e. not decoded) tile.
public RawTileSize ( int tile ) : long
tile int The zero-based index of a tile.
return long

ReadBufferSetup() public method

Sets up the data buffer used to read raw (encoded) data from a file.

This method is provided for client-control of the I/O buffers used by the library. Applications need never use this method; it's provided only for "intelligent clients" that wish to optimize memory usage and/or eliminate potential copy operations that can occur when working with images that have data stored without compression.

If the buffer is null, then a buffer of appropriate size is allocated by the library. Otherwise, the caller must guarantee that the buffer is large enough to hold any individual strip of raw data.

public ReadBufferSetup ( byte buffer, int size ) : void
buffer byte The data buffer.
size int The buffer size.
return void

ReadCustomDirectory() public method

Reads a custom directory from the arbitrary offset within file/stream.
public ReadCustomDirectory ( long offset, TiffFieldInfo info, int count ) : bool
offset long The directory offset.
info TiffFieldInfo The array of objects to read from /// custom directory. Standard objects are ignored.
count int The number of items to use from /// the array.
return bool

ReadDirectory() public method

Reads the contents of the next TIFF directory in an open TIFF file/stream and makes it the current directory.

Directories are read sequentially.

Applications only need to call ReadDirectory to read multiple subfiles in a single TIFF file/stream - the first directory in a file/stream is automatically read when Open(string, string) or ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream) is called.

The images that have a single uncompressed strip or tile of data are automatically treated as if they were made up of multiple strips or tiles of approximately 8 kilobytes each. This operation is done only in-memory; it does not alter the contents of the file/stream. However, the construction of the "chopped strips" is visible to the application through the number of strips returned by NumberOfStrips or the number of tiles returned by NumberOfTiles.

public ReadDirectory ( ) : bool
return bool

ReadEXIFDirectory() public method

Reads an EXIF directory from the given offset within file/stream.
public ReadEXIFDirectory ( long offset ) : bool
offset long The directory offset.
return bool

ReadEncodedStrip() public method

Reads a strip of data from an open TIFF file/stream, decompresses it and places specified amount of decompressed bytes into the user supplied buffer.

The value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

To read a full strip of data the data buffer should typically be at least as large as the number returned by StripSize. If the -1 passed in count parameter, the whole strip will be read. You should be sure you have enough space allocated for the buffer.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

public ReadEncodedStrip ( int strip, byte buffer, int offset, int count ) : int
strip int The zero-based index of the strip to read.
buffer byte The buffer to place decompressed strip bytes to.
offset int The zero-based byte offset in buffer at which to begin storing /// decompressed strip bytes.
count int The maximum number of decompressed strip bytes to be stored /// to buffer.
return int

ReadEncodedTile() public method

Reads a tile of data from an open TIFF file/stream, decompresses it and places specified amount of decompressed bytes into the user supplied buffer.

The value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

To read a full tile of data the data buffer should typically be at least as large as the number returned by TileSize. If the -1 passed in count parameter, the whole tile will be read. You should be sure you have enough space allocated for the buffer.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

public ReadEncodedTile ( int tile, byte buffer, int offset, int count ) : int
tile int The zero-based index of the tile to read.
buffer byte The buffer to place decompressed tile bytes to.
offset int The zero-based byte offset in buffer at which to begin storing /// decompressed tile bytes.
count int The maximum number of decompressed tile bytes to be stored /// to buffer.
return int

ReadRGBAImage() public method

Reads the image and decodes it into RGBA format raster.

ReadRGBAImage reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data are placed in the lower part of the raster. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner. Please use O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImageOriented if you want to specify another raster origin.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImage converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImage is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

public ReadRGBAImage ( int width, int height, int raster ) : bool
width int The raster width.
height int The raster height.
raster int The raster (the buffer to place decoded image data to).
return bool

ReadRGBAImage() public method

Reads the image and decodes it into RGBA format raster.

ReadRGBAImage reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data are placed in the lower part of the raster. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner. Please use O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImageOriented if you want to specify another raster origin.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImage converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImage is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

public ReadRGBAImage ( int width, int height, int raster, bool stopOnError ) : bool
width int The raster width.
height int The raster height.
raster int The raster (the buffer to place decoded image data to).
stopOnError bool if set to true then an error will terminate the /// operation; otherwise method will continue processing data until all the possible data /// in the image have been requested.
return bool

ReadRGBAImageOriented() public method

Reads the image and decodes it into RGBA format raster using specified raster origin.

ReadRGBAImageOriented reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data placement depends on orientation. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin specified by orientation parameter.

When ReadRGBAImageOriented is used with Orientation.BOTLEFT for the orientation the produced result is the same as retuned by O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImageOriented converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImageOriented is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

public ReadRGBAImageOriented ( int width, int height, int raster, Orientation orientation ) : bool
width int The raster width.
height int The raster height.
raster int The raster (the buffer to place decoded image data to).
orientation Orientation The raster origin position.
return bool

ReadRGBAImageOriented() public method

Reads the image and decodes it into RGBA format raster using specified raster origin.

ReadRGBAImageOriented reads a strip- or tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times height 32-bit entries, where width must be less than or equal to the width of the image (height may be any non-zero size). If the raster dimensions are smaller than the image, the image data is cropped to the raster bounds. If the raster height is greater than that of the image, then the image data placement depends on orientation. Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin specified by orientation parameter.

When ReadRGBAImageOriented is used with Orientation.BOTLEFT for the orientation the produced result is the same as retuned by O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

ReadRGBAImageOriented converts non-8-bit images by scaling sample values. Palette, grayscale, bilevel, CMYK, and YCbCr images are converted to RGB transparently. Raster pixels are returned uncorrected by any colorimetry information present in the directory.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAImageOriented is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

public ReadRGBAImageOriented ( int width, int height, int raster, Orientation orientation, bool stopOnError ) : bool
width int The raster width.
height int The raster height.
raster int The raster (the buffer to place decoded image data to).
orientation Orientation The raster origin position.
stopOnError bool if set to true then an error will terminate the /// operation; otherwise method will continue processing data until all the possible data /// in the image have been requested.
return bool

ReadRGBAStrip() public method

Reads a whole strip of a strip-based image, decodes it and converts it to RGBA format.

ReadRGBAStrip reads a single strip of a strip-based image into memory, storing the result in the user supplied RGBA raster. If specified strip is the last strip, then it will only contain the portion of the strip that is actually within the image space. The raster is assumed to be an array of width times rowsperstrip 32-bit entries, where width is the width of the image (TiffTag.IMAGEWIDTH) and rowsperstrip is the maximum lines in a strip (TiffTag.ROWSPERSTRIP).

The row value should be the row of the first row in the strip (strip * rowsperstrip, zero based).

Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner of the strip. That is bottom to top organization. When reading a partial last strip in the file the last line of the image will begin at the beginning of the buffer.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

See TiffRgbaImage for more details on how various image types are converted to RGBA values.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBAStrip's main advantage over the similar O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage function is that for large images a single buffer capable of holding the whole image doesn't need to be allocated, only enough for one strip. The ReadRGBATile function does a similar operation for tiled images.

ReadRGBAStrip is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

public ReadRGBAStrip ( int row, int raster ) : bool
row int The row.
raster int The RGBA raster.
return bool

ReadRGBATile() public method

Reads a whole tile of a tile-based image, decodes it and converts it to RGBA format.

ReadRGBATile reads a single tile of a tile-based image into memory, storing the result in the user supplied RGBA raster. The raster is assumed to be an array of width times length 32-bit entries, where width is the width of the tile (TiffTag.TILEWIDTH) and length is the height of a tile (TiffTag.TILELENGTH).

The col and row values are the offsets from the top left corner of the image to the top left corner of the tile to be read. They must be an exact multiple of the tile width and length.

Note that the raster is assumed to be organized such that the pixel at location (x, y) is raster[y * width + x]; with the raster origin in the lower-left hand corner of the tile. That is bottom to top organization. Edge tiles which partly fall off the image will be filled out with appropriate zeroed areas.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The Tiff.GetR, Tiff.GetG, Tiff.GetB, and Tiff.GetA should be used to access individual samples. Images without Associated Alpha matting information have a constant Alpha of 1.0 (255).

See TiffRgbaImage for more details on how various image types are converted to RGBA values.

Samples must be either 1, 2, 4, 8, or 16 bits. Colorimetric samples/pixel must be either 1, 3, or 4 (i.e. SamplesPerPixel minus ExtraSamples).

Palette image colormaps that appear to be incorrectly written as 8-bit values are automatically scaled to 16-bits.

ReadRGBATile's main advantage over the similar O:BitMiracle.LibTiff.Classic.Tiff.ReadRGBAImage function is that for large images a single buffer capable of holding the whole image doesn't need to be allocated, only enough for one tile. The ReadRGBAStrip function does a similar operation for stripped images.

ReadRGBATile is just a wrapper around the more general TiffRgbaImage facilities.

All error messages are directed to the current error handler.

public ReadRGBATile ( int col, int row, int raster ) : bool
col int The column.
row int The row.
raster int The RGBA raster.
return bool

ReadRawStrip() public method

Reads the undecoded contents of a strip of data from an open TIFF file/stream and places specified amount of read bytes into the user supplied buffer.

The value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

To read a full strip of data the data buffer should typically be at least as large as the number returned by RawStripSize. If the -1 passed in count parameter, the whole strip will be read. You should be sure you have enough space allocated for the buffer.

public ReadRawStrip ( int strip, byte buffer, int offset, int count ) : int
strip int The zero-based index of the strip to read.
buffer byte The buffer to place read bytes to.
offset int The zero-based byte offset in buffer at which to begin storing /// read bytes.
count int The maximum number of read bytes to be stored to buffer.
return int

ReadRawTile() public method

Reads the undecoded contents of a tile of data from an open TIFF file/stream and places specified amount of read bytes into the user supplied buffer.

The value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

To read a full tile of data the data buffer should typically be at least as large as the number returned by RawTileSize. If the -1 passed in count parameter, the whole tile will be read. You should be sure you have enough space allocated for the buffer.

public ReadRawTile ( int tile, byte buffer, int offset, int count ) : int
tile int The zero-based index of the tile to read.
buffer byte The buffer to place read tile bytes to.
offset int The zero-based byte offset in buffer at which to begin storing /// read tile bytes.
count int The maximum number of read tile bytes to be stored to buffer.
return int

ReadScanline() public method

Reads and decodes a scanline of data from an open TIFF file/stream.

ReadScanline reads the data for the specified row into the user supplied data buffer buffer. The data are returned decompressed and, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire scanline of data. Applications should call the ScanlineSize to find out the size (in bytes) of a scanline buffer. Applications should use ReadScanline(byte[], int, short) or ReadScanline(byte[], int, int, short) and specify correct sample plane if image data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

public ReadScanline ( byte buffer, int row ) : bool
buffer byte The buffer to place read and decoded image data to.
row int The zero-based index of scanline (row) to read.
return bool

ReadScanline() public method

Reads and decodes a scanline of data from an open TIFF file/stream.

ReadScanline reads the data for the specified row and specified sample plane plane into the user supplied data buffer buffer. The data are returned decompressed and, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire scanline of data. Applications should call the ScanlineSize to find out the size (in bytes) of a scanline buffer. Applications may use ReadScanline(byte[], int) or specify 0 for plane parameter if image data is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

public ReadScanline ( byte buffer, int offset, int row, short plane ) : bool
buffer byte The buffer to place read and decoded image data to.
offset int The zero-based byte offset in at which /// to begin storing read and decoded bytes.
row int The zero-based index of scanline (row) to read.
plane short The zero-based index of the sample plane.
return bool

ReadScanline() public method

Reads and decodes a scanline of data from an open TIFF file/stream.

ReadScanline reads the data for the specified row and specified sample plane plane into the user supplied data buffer buffer. The data are returned decompressed and, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire scanline of data. Applications should call the ScanlineSize to find out the size (in bytes) of a scanline buffer. Applications may use ReadScanline(byte[], int) or specify 0 for plane parameter if image data is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

public ReadScanline ( byte buffer, int row, short plane ) : bool
buffer byte The buffer to place read and decoded image data to.
row int The zero-based index of scanline (row) to read.
plane short The zero-based index of the sample plane.
return bool

ReadTile() public method

Reads and decodes a tile of data from an open TIFF file/stream.

The tile to read and decode is selected by the (x, y, z, plane) coordinates (i.e. ReadTile returns the data for the tile containing the specified coordinates. The data placed in buffer are returned decompressed and, typically, in the native byte- and bit-ordering, but are otherwise packed (see further below). The buffer must be large enough to hold an entire tile of data. Applications should call the TileSize to find out the size (in bytes) of a tile buffer. The x and y parameters are always used by ReadTile. The z parameter is used if the image is deeper than 1 slice (a value of TiffTag.IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the value of TiffTag.FILLORDER tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order.

public ReadTile ( byte buffer, int offset, int x, int y, int z, short plane ) : int
buffer byte The buffer to place read and decoded image data to.
offset int The zero-based byte offset in at which /// to begin storing read and decoded bytes.
x int The x-coordinate of the pixel within a tile to be read and decoded.
y int The y-coordinate of the pixel within a tile to be read and decoded.
z int The z-coordinate of the pixel within a tile to be read and decoded.
plane short The zero-based index of the sample plane.
return int

Realloc() public static method

Allocates new byte array of specified size and copies data from the existing to the new array.
public static Realloc ( byte array, int size ) : byte[]
array byte The existing array.
size int The number of elements in new array.
return byte[]

Realloc() public static method

Allocates new integer array of specified size and copies data from the existing to the new array.
Size of the array is in elements, not bytes.
public static Realloc ( int array, int size ) : int[]
array int The existing array.
size int The number of elements in new array.
return int[]

RegisterCodec() public method

Adds specified codec to a list of registered codec.
This method can be used to augment or override the set of codecs available to an application. If the codec is for a scheme that already has a registered codec then it is overridden and any images with data encoded with this compression scheme will be decoded using the supplied codec.
public RegisterCodec ( TiffCodec codec ) : void
codec TiffCodec The codec to register.
return void

ReverseBits() public static method

Replaces specified number of bytes in buffer with the equivalent bit-reversed bytes.
This operation is performed with a lookup table, which can be retrieved using the GetBitRevTable method.
public static ReverseBits ( byte buffer, int count ) : void
buffer byte The buffer to replace bytes in.
count int The number of bytes to process.
return void

ReverseBits() public static method

Replaces specified number of bytes in buffer with the equivalent bit-reversed bytes starting at specified offset.
This operation is performed with a lookup table, which can be retrieved using the GetBitRevTable method.
public static ReverseBits ( byte buffer, int offset, int count ) : void
buffer byte The buffer to replace bytes in.
offset int The zero-based offset in at /// which to begin processing bytes.
count int The number of bytes to process.
return void

RewriteDirectory() public method

Rewrites the contents of the current directory to the file and setup to create a new subfile (page) in the same file.
The RewriteDirectory operates similarly to WriteDirectory, but can be called with directories previously read or written that already have an established location in the file. It will rewrite the directory, but instead of place it at it's old location (as WriteDirectory would) it will place them at the end of the file, correcting the pointer from the preceeding directory or file header to point to it's new location. This is particularly important in cases where the size of the directory and pointed to data has grown, so it won’t fit in the space available at the old location. Note that this will result in the loss of the previously used directory space.
public RewriteDirectory ( ) : bool
return bool

ScanlineSize() public method

Calculates the size in bytes of a row of data as it would be returned in a call to O:BitMiracle.LibTiff.Classic.Tiff.ReadScanline, or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline.
ScanlineSize calculates size for one sample plane only. Please use RasterScanlineSize if you want to get size in bytes of a complete decoded and packed raster scanline.
public ScanlineSize ( ) : int
return int

SetClientInfo() public method

Associates extra information with this Tiff.
If there is already an extra information with the name specified by name it will be replaced by the information specified by data.
public SetClientInfo ( object data, string name ) : void
data object The information to associate with this .
name string The name (label) of the information.
return void

SetClientdata() public method

Asscociates a custom data with this Tiff.
public SetClientdata ( object data ) : object
data object The data to associate.
return object

SetDirectory() public method

Sets the directory with specified number as the current directory.
SetDirectory changes the current directory and reads its contents with ReadDirectory.
public SetDirectory ( short number ) : bool
number short The zero-based number of the directory to set as the /// current directory.
return bool

SetErrorHandler() public static method

Sets an instance of the TiffErrorHandler class as custom library-wide error and warning handler.
public static SetErrorHandler ( TiffErrorHandler errorHandler ) : TiffErrorHandler
errorHandler TiffErrorHandler An instance of the class /// to set as custom library-wide error and warning handler.
return TiffErrorHandler

SetField() public method

Sets the value(s) of a tag in a TIFF file/stream open for writing.

SetField sets the value of a tag or pseudo-tag in the current directory associated with the open TIFF file/stream. To set the value of a field the file/stream must have been previously opened for writing with Open(string, string) or ClientOpen(string, string, object, BitMiracle.LibTiff.Classic.TiffStream); pseudo-tags can be set whether the file was opened for reading or writing. The tag is identified by tag. The type and number of values in value is dependent on the tag being set. You may want to consult "Well-known tags and their value(s) data types" to become familiar with exact data types and calling conventions required for each tag supported by the library.

A pseudo-tag is a parameter that is used to control the operation of the library but whose value is not read or written to the underlying file.

The field will be written to the file when/if the directory structure is updated.

public SetField ( TiffTag tag ) : bool
tag TiffTag The tag.
return bool

SetFileName() public method

Sets the new ID string for this Tiff.
Please note, that name is an arbitrary string used as ID for this Tiff. It's not required to be a file name or anything meaningful at all.
public SetFileName ( string name ) : string
name string The ID string for this .
return string

SetMode() public method

Sets the new mode for the underlying file or stream.
public SetMode ( int mode ) : int
mode int The new mode for the underlying file or stream.
return int

SetSubDirectory() public method

Sets the directory at specified file/stream offset as the current directory.
SetSubDirectory acts like SetDirectory, except the directory is specified as a file offset instead of an index; this is required for accessing subdirectories linked through a SubIFD tag (e.g. thumbnail images).
public SetSubDirectory ( long offset ) : bool
offset long The offset from the beginnig of the file/stream to the directory /// to set as the current directory.
return bool

SetTagExtender() public static method

Sets the tag extender method.
Extender method is called upon creation of each instance of Tiff object.
public static SetTagExtender ( TiffExtendProc extender ) : TiffExtendProc
extender TiffExtendProc The tag extender method.
return TiffExtendProc

SetTagMethods() public method

Sets the new tag methods to use.
public SetTagMethods ( TiffTagMethods methods ) : TiffTagMethods
methods TiffTagMethods Tag methods.
return TiffTagMethods

SetWriteOffset() public method

Sets the current write offset.
This should only be used to set the offset to a known previous location (very carefully), or to 0 so that the next write gets appended to the end of the file.
public SetWriteOffset ( long offset ) : void
offset long The write offset.
return void

SetupStrips() public method

Setups the strips.
public SetupStrips ( ) : bool
return bool

ShortsToByteArray() public static method

Converts array of 16-bit values into array of bytes.
public static ShortsToByteArray ( short source, int srcOffset, int srcCount, byte bytes, int offset ) : void
source short The array of 16-bit values.
srcOffset int The zero-based offset in at /// which to begin converting bytes.
srcCount int The number of 16-bit values to convert.
bytes byte The byte array to store converted values at.
offset int The zero-based offset in at /// which to begin storing converted values.
return void

StripSize() public method

Computes the number of bytes in a row-aligned strip.

StripSize returns the equivalent size for a strip of data as it would be returned in a call to ReadEncodedStrip or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteEncodedStrip.

If the value of the field corresponding to TiffTag.ROWSPERSTRIP is larger than the recorded TiffTag.IMAGELENGTH, then the strip size is truncated to reflect the actual space required to hold the strip.

public StripSize ( ) : int
return int

SwabArrayOfDouble() public static method

Swaps the bytes in specified number of values in the array of double-precision floating-point numbers.
public static SwabArrayOfDouble ( double array, int count ) : void
array double The array to swap bytes in.
count int The number of items to swap bytes in.
return void

SwabArrayOfDouble() public static method

Swaps the bytes in specified number of values in the array of double-precision floating-point numbers starting at specified offset.
public static SwabArrayOfDouble ( double array, int offset, int count ) : void
array double The array to swap bytes in.
offset int The zero-based offset in at /// which to begin swapping bytes.
count int The number of items to swap bytes in.
return void

SwabArrayOfLong() public static method

Swaps the bytes in specified number of values in the array of 32-bit items.
public static SwabArrayOfLong ( int array, int count ) : void
array int The array to swap bytes in.
count int The number of items to swap bytes in.
return void

SwabArrayOfLong() public static method

Swaps the bytes in specified number of values in the array of 32-bit items starting at specified offset.
public static SwabArrayOfLong ( int array, int offset, int count ) : void
array int The array to swap bytes in.
offset int The zero-based offset in at /// which to begin swapping bytes.
count int The number of items to swap bytes in.
return void

SwabArrayOfShort() public static method

Swaps the bytes in specified number of values in the array of 16-bit items.
public static SwabArrayOfShort ( short array, int count ) : void
array short The array to swap bytes in.
count int The number of items to swap bytes in.
return void

SwabArrayOfShort() public static method

Swaps the bytes in specified number of values in the array of 16-bit items starting at specified offset.
public static SwabArrayOfShort ( short array, int offset, int count ) : void
array short The array to swap bytes in.
offset int The zero-based offset in at /// which to begin swapping bytes.
count int The number of items to swap bytes in.
return void

SwabArrayOfTriples() public static method

Swaps the bytes in specified number of values in the array of triples (24-bit items).
public static SwabArrayOfTriples ( byte array, int count ) : void
array byte The array to swap bytes in.
count int The number of items to swap bytes in.
return void

SwabArrayOfTriples() public static method

Swaps the bytes in specified number of values in the array of triples (24-bit items) starting at specified offset.
public static SwabArrayOfTriples ( byte array, int offset, int count ) : void
array byte The array to swap bytes in.
offset int The zero-based offset in at /// which to begin swapping bytes.
count int The number of items to swap bytes in.
return void

SwabDouble() public static method

Swaps the bytes in a single double-precision floating-point number.
public static SwabDouble ( double &value ) : void
value double The value to swap bytes in.
return void

SwabLong() public static method

Swaps the bytes in a single 32-bit item.
public static SwabLong ( int &value ) : void
value int The value to swap bytes in.
return void

SwabShort() public static method

Swaps the bytes in a single 16-bit item.
public static SwabShort ( short &value ) : void
value short The value to swap bytes in.
return void

TileRowSize() public method

Compute the number of bytes in each row of a tile.
public TileRowSize ( ) : int
return int

TileSize() public method

Compute the number of bytes in a row-aligned tile.
TileSize returns the equivalent size for a tile of data as it would be returned in a call to ReadTile or as it would be expected in a call to O:BitMiracle.LibTiff.Classic.Tiff.WriteTile.
public TileSize ( ) : int
return int

UnRegisterCodec() public method

Removes specified codec from a list of registered codecs.
public UnRegisterCodec ( TiffCodec codec ) : void
codec TiffCodec The codec to remove from a list of registered codecs.
return void

UnlinkDirectory() public method

Unlinks the specified directory from the directory chain.
UnlinkDirectory does not removes directory bytes from the file/stream. It only makes them unused.
public UnlinkDirectory ( short number ) : bool
number short The zero-based number of the directory to unlink.
return bool

VStripSize() public method

Computes the number of bytes in a row-aligned strip with specified number of rows.
public VStripSize ( int rowCount ) : int
rowCount int The number of rows in a strip.
return int

VTileSize() public method

Computes the number of bytes in a row-aligned tile with specified number of rows.
public VTileSize ( int rowCount ) : int
rowCount int The number of rows in a tile.
return int

Warning() public static method

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

public static Warning ( Tiff tif, string method, string format ) : void
tif Tiff An instance of the class. Can be null.
method string The method in which a warning is detected.
format string A composite format string (see Remarks).
return void

Warning() public static method

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

public static Warning ( string method, string format ) : void
method string The method in which a warning is detected.
format string A composite format string (see Remarks).
return void

WarningExt() public static method

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error and passes client data to the warning handler.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the warning handler. Default warning handler does not use it. Only custom warning handlers may make use of it.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

public static WarningExt ( Tiff tif, object clientData, string method, string format ) : void
tif Tiff An instance of the class. Can be null.
clientData object The client data to be passed to warning handler.
method string The method in which a warning is detected.
format string A composite format string (see Remarks).
return void

WarningExt() public static method

Invokes the library-wide warning handling methods to (normally) write a warning message to the Console.Error and passes client data to the warning handler.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which a warning is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the warning handler. Default warning handler does not use it. Only custom warning handlers may make use of it.

Applications that desire to capture control in the event of a warning should use SetErrorHandler to override the default error and warning handler.

public static WarningExt ( object clientData, string method, string format ) : void
clientData object The client data to be passed to warning handler.
method string The method in which a warning is detected.
format string A composite format string (see Remarks).
return void

WriteBufferSetup() public method

Sets up the data buffer used to write raw (encoded) data to a file.

This method is provided for client-control of the I/O buffers used by the library. Applications need never use this method; it's provided only for "intelligent clients" that wish to optimize memory usage and/or eliminate potential copy operations that can occur when working with images that have data stored without compression.

If the size is -1 then the buffer size is selected to hold a complete tile or strip, or at least 8 kilobytes, whichever is greater. If the buffer is null, then a buffer of appropriate size is allocated by the library.

public WriteBufferSetup ( byte buffer, int size ) : void
buffer byte The data buffer.
size int The buffer size.
return void

WriteCheck() public method

Verifies that file/stream is writable and that the directory information is setup properly.
public WriteCheck ( bool tiles, string method ) : bool
tiles bool If set to true then ability to write tiles will be verified; /// otherwise, ability to write strips will be verified.
method string The name of the calling method.
return bool

WriteDirectory() public method

Writes the contents of the current directory to the file and setup to create a new subfile (page) in the same file.
Applications only need to call WriteDirectory when writing multiple subfiles (pages) to a single TIFF file. WriteDirectory is automatically called by Close and Flush to write a modified directory if the file is open for writing.
public WriteDirectory ( ) : bool
return bool

WriteEncodedStrip() public method

Encodes and writes a strip of data to an open TIFF file/stream.

WriteEncodedStrip encodes count bytes of raw data from buffer and append the result to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

public WriteEncodedStrip ( int strip, byte buffer, int count ) : int
strip int The zero-based index of the strip to write.
buffer byte The buffer with image data to be encoded and written.
count int The maximum number of strip bytes to be read from /// .
return int

WriteEncodedStrip() public method

Encodes and writes a strip of data to an open TIFF file/stream.

WriteEncodedStrip encodes count bytes of raw data from buffer and append the result to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

public WriteEncodedStrip ( int strip, byte buffer, int offset, int count ) : int
strip int The zero-based index of the strip to write.
buffer byte The buffer with image data to be encoded and written.
offset int The zero-based byte offset in at which /// to begin reading bytes to be encoded and written.
count int The maximum number of strip bytes to be read from /// .
return int

WriteEncodedTile() public method

Encodes and writes a tile of data to an open TIFF file/stream.

WriteEncodedTile encodes count bytes of raw data from buffer and append the result to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteEncodedTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

public WriteEncodedTile ( int tile, byte buffer, int count ) : int
tile int The zero-based index of the tile to write.
buffer byte The buffer with image data to be encoded and written.
count int The maximum number of tile bytes to be read from /// .
return int

WriteEncodedTile() public method

Encodes and writes a tile of data to an open TIFF file/stream.

WriteEncodedTile encodes count bytes of raw data from buffer and append the result to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteEncodedTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8.

public WriteEncodedTile ( int tile, byte buffer, int offset, int count ) : int
tile int The zero-based index of the tile to write.
buffer byte The buffer with image data to be encoded and written.
offset int The zero-based byte offset in at which /// to begin reading bytes to be encoded and written.
count int The maximum number of tile bytes to be read from /// .
return int

WriteRawStrip() public method

Writes a strip of raw data to an open TIFF file/stream.

WriteRawStrip appends count bytes of raw data from buffer to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

public WriteRawStrip ( int strip, byte buffer, int count ) : int
strip int The zero-based index of the strip to write.
buffer byte The buffer with raw image data to be written.
count int The maximum number of strip bytes to be read from /// .
return int

WriteRawStrip() public method

Writes a strip of raw data to an open TIFF file/stream.

WriteRawStrip appends count bytes of raw data from buffer to the specified strip; replacing any previously written data. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the strip (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

public WriteRawStrip ( int strip, byte buffer, int offset, int count ) : int
strip int The zero-based index of the strip to write.
buffer byte The buffer with raw image data to be written.
offset int The zero-based byte offset in at which /// to begin reading bytes to be written.
count int The maximum number of strip bytes to be read from /// .
return int

WriteRawTile() public method

Writes a tile of raw data to an open TIFF file/stream.

WriteRawTile appends count bytes of raw data to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteRawTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

public WriteRawTile ( int tile, byte buffer, int count ) : int
tile int The zero-based index of the tile to write.
buffer byte The buffer with raw image data to be written.
count int The maximum number of tile bytes to be read from /// .
return int

WriteRawTile() public method

Writes a tile of raw data to an open TIFF file/stream.

WriteRawTile appends count bytes of raw data to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile automatically does this when converting an (x, y, z, plane) coordinate quadruple to a tile number.

There must be space for the data. The function clamps individual writes to a tile to the tile size, but does not (and can not) check that multiple writes to the same tile were performed.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteRawTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

public WriteRawTile ( int tile, byte buffer, int offset, int count ) : int
tile int The zero-based index of the tile to write.
buffer byte The buffer with raw image data to be written.
offset int The zero-based byte offset in at which /// to begin reading bytes to be written.
count int The maximum number of tile bytes to be read from /// .
return int

WriteScanline() public method

Encodes and writes a scanline of data to an open TIFF file/stream.

WriteScanline encodes and writes to a file at the specified row. Applications should use WriteScanline(byte[], int, short) or WriteScanline(byte[], int, int, short) and specify correct sample plane parameter if image data in a file/stream is organized in separate planes (i.e TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE).

The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the scanline (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.

Once data are written to a file/stream for the current directory, the values of certain tags may not be altered; see "Well-known tags and their value(s) data types" for more information.

It is not possible to write scanlines to a file/stream that uses a tiled organization. The IsTiled can be used to determine if the file/stream is organized as tiles or strips.

public WriteScanline ( byte buffer, int row ) : bool
buffer byte The buffer with image data to be encoded and written.
row int The zero-based index of scanline (row) to place encoded data at.
return bool

WriteScanline() public method

Encodes and writes a scanline of data to an open TIFF file/stream.

WriteScanline encodes and writes to a file at the specified row and specified sample plane plane. Applications may use WriteScanline(byte[], int) or specify 0 for plane parameter if image data in a file/stream is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the scanline (except for TiffTag.PLANARCONFIG = PlanarConfig.CONTIG, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.

Once data are written to a file/stream for the current directory, the values of certain tags may not be altered; see "Well-known tags and their value(s) data types" for more information.

It is not possible to write scanlines to a file/stream that uses a tiled organization. The IsTiled can be used to determine if the file/stream is organized as tiles or strips.

public WriteScanline ( byte buffer, int offset, int row, short plane ) : bool
buffer byte The buffer with image data to be encoded and written.
offset int The zero-based byte offset in at which /// to begin reading bytes.
row int The zero-based index of scanline (row) to place encoded data at.
plane short The zero-based index of the sample plane.
return bool

WriteScanline() public method

Encodes and writes a scanline of data to an open TIFF file/stream.

WriteScanline encodes and writes to a file at the specified row and specified sample plane plane. Applications may use WriteScanline(byte[], int) or specify 0 for plane parameter if image data in a file/stream is contiguous (i.e not organized in separate planes, TiffTag.PLANARCONFIG = PlanarConfig.CONTIG).

The data are assumed to be uncompressed and in the native bit- and byte-order of the host machine. The data written to the file is compressed according to the compression scheme of the current TIFF directory (see further below). If the current scanline is past the end of the current subfile, the value of TiffTag.IMAGELENGTH tag is automatically increased to include the scanline (except for TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE, where the TiffTag.IMAGELENGTH tag cannot be changed once the first data are written). If the TiffTag.IMAGELENGTH is increased, the values of TiffTag.STRIPOFFSETS and TiffTag.STRIPBYTECOUNTS tags are similarly enlarged to reflect data written past the previous end of image.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with value of TiffTag.BITSPERSAMPLE tag greater than 8. The library attempts to hide bit-ordering differences between the image and the native machine by converting data from the native machine order.

Once data are written to a file/stream for the current directory, the values of certain tags may not be altered; see "Well-known tags and their value(s) data types" for more information.

It is not possible to write scanlines to a file/stream that uses a tiled organization. The IsTiled can be used to determine if the file/stream is organized as tiles or strips.

public WriteScanline ( byte buffer, int row, short plane ) : bool
buffer byte The buffer with image data to be encoded and written.
row int The zero-based index of scanline (row) to place encoded data at.
plane short The zero-based index of the sample plane.
return bool

WriteTile() public method

Encodes and writes a tile of data to an open TIFF file/stream.

The tile to place encoded data is selected by the (x, y, z, plane) coordinates (i.e. WriteTile writes data to the tile containing the specified coordinates. WriteTile (potentially) encodes the data buffer and writes it to open file/stream. The buffer must contain an entire tile of data. Applications should call the TileSize to find out the size (in bytes) of a tile buffer. The x and y parameters are always used by WriteTile. The z parameter is used if the image is deeper than 1 slice (a value of TiffTag.IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

public WriteTile ( byte buffer, int offset, int x, int y, int z, short plane ) : int
buffer byte The buffer with image data to be encoded and written.
offset int The zero-based byte offset in at which /// to begin reading bytes to be encoded and written.
x int The x-coordinate of the pixel within a tile to be encoded and written.
y int The y-coordinate of the pixel within a tile to be encoded and written.
z int The z-coordinate of the pixel within a tile to be encoded and written.
plane short The zero-based index of the sample plane.
return int

WriteTile() public method

Encodes and writes a tile of data to an open TIFF file/stream.

The tile to place encoded data is selected by the (x, y, z, plane) coordinates (i.e. WriteTile writes data to the tile containing the specified coordinates. WriteTile (potentially) encodes the data buffer and writes it to open file/stream. The buffer must contain an entire tile of data. Applications should call the TileSize to find out the size (in bytes) of a tile buffer. The x and y parameters are always used by WriteTile. The z parameter is used if the image is deeper than 1 slice (a value of TiffTag.IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (TiffTag.PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

A correct value for the TiffTag.IMAGELENGTH tag must be setup before writing; WriteTile does not support automatically growing the image on each write (as O:BitMiracle.LibTiff.Classic.Tiff.WriteScanline does).

public WriteTile ( byte buffer, int x, int y, int z, short plane ) : int
buffer byte The buffer with image data to be encoded and written.
x int The x-coordinate of the pixel within a tile to be encoded and written.
y int The y-coordinate of the pixel within a tile to be encoded and written.
z int The z-coordinate of the pixel within a tile to be encoded and written.
plane short The zero-based index of the sample plane.
return int