Show / Hide Table of Contents

Class Tiff

Tag Image File Format (TIFF)

Inheritance
System.Object
Tiff
Implements
System.IDisposable
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: BitMiracle.LibTiff.Classic
Assembly: BitMiracle.LibTiff.NET.dll
Syntax
public class Tiff : IDisposable
Remarks

Based on Rev 6.0 from http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf

Properties

| Improve this Doc View Source

AssemblyVersion

Gets the version of the library's assembly.

Declaration
public static string AssemblyVersion { get; }
Property Value
Type Description
System.String

The version of the library's assembly.

Methods

| Improve this Doc View Source

ByteArrayToInts(Byte[], Int32, Int32)

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

Declaration
public static int[] ByteArrayToInts(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer

The byte buffer.

System.Int32 offset

The zero-based offset in buffer at which to begin converting bytes.

System.Int32 count

The number of bytes to convert.

Returns
Type Description
System.Int32[]

The array of 32-bit values.

| Improve this Doc View Source

ByteArrayToLong8(Byte[], Int32, Int32)

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

Declaration
public static long[] ByteArrayToLong8(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer

The byte buffer.

System.Int32 offset

The zero-based offset in buffer at which to begin converting bytes.

System.Int32 count

The number of bytes to convert.

Returns
Type Description
System.Int64[]

The array of 64-bit values.

| Improve this Doc View Source

ByteArrayToShorts(Byte[], Int32, Int32)

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

Declaration
public static short[] ByteArrayToShorts(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer

The byte buffer.

System.Int32 offset

The zero-based offset in buffer at which to begin converting bytes.

System.Int32 count

The number of bytes to convert.

Returns
Type Description
System.Int16[]

The array of 16-bit values.

| Improve this Doc View Source

CheckpointDirectory()

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

Declaration
public bool CheckpointDirectory()
Returns
Type Description
System.Boolean

true if the current directory was rewritten successfully; otherwise, false

Remarks

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.

| Improve this Doc View Source

CheckTile(Int32, Int32, Int32, Int16)

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

Declaration
public bool CheckTile(int x, int y, int z, short plane)
Parameters
Type Name Description
System.Int32 x

The x-coordinate.

System.Int32 y

The y-coordinate.

System.Int32 z

The z-coordinate.

System.Int16 plane

The sample plane.

Returns
Type Description
System.Boolean

true if the specified coordinates are within the bounds of the image; otherwise, false.

Remarks

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

| Improve this Doc View Source

Clientdata()

Returns the custom client data associated with this Tiff.

Declaration
public object Clientdata()
Returns
Type Description
System.Object

The custom client data associated with this Tiff.

| Improve this Doc View Source

ClientOpen(String, String, Object, TiffStream)

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

Declaration
public static Tiff ClientOpen(string name, string mode, object clientData, TiffStream stream)
Parameters
Type Name Description
System.String name

The name for the new instance of Tiff class.

System.String mode

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 Open(String, String) method for the list of the mode flags).

System.Object clientData

Some client data. This data is passed as parameter to every method of the TiffStream object specified by the stream parameter.

TiffStream stream

An instance of the TiffStream class to use for reading, writing and seeking of TIFF data.

Returns
Type Description
Tiff

The new instance of Tiff class if stream is successfully opened; otherwise, null.

Remarks

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.

| Improve this Doc View Source

Close()

Closes a previously opened TIFF file.

Declaration
public void Close()
Remarks

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

| Improve this Doc View Source

Compare(Int16[], Int16[], Int32)

Compares specified number of elements in two arrays.

Declaration
public static int Compare(short[] first, short[] second, int elementCount)
Parameters
Type Name Description
System.Int16[] first

The first array to compare.

System.Int16[] second

The second array to compare.

System.Int32 elementCount

The number of elements to compare.

Returns
Type Description
System.Int32

The difference between compared elements or 0 if all elements are equal.

| Improve this Doc View Source

ComputeStrip(Int32, Int16)

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

Declaration
public int ComputeStrip(int row, short plane)
Parameters
Type Name Description
System.Int32 row

The row.

System.Int16 plane

The sample plane.

Returns
Type Description
System.Int32

The number of the strip that contains the specified coordinates.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE).

| Improve this Doc View Source

ComputeTile(Int32, Int32, Int32, Int16)

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

Declaration
public int ComputeTile(int x, int y, int z, short plane)
Parameters
Type Name Description
System.Int32 x

The x-coordinate.

System.Int32 y

The y-coordinate.

System.Int32 z

The z-coordinate.

System.Int16 plane

The sample plane.

Returns
Type Description
System.Int32

The number of the tile that contains the specified coordinates.

Remarks

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 (IMAGEDEPTH > 1). The plane parameter is used only if data are organized in separate planes (PLANARCONFIG = PlanarConfig.SEPARATE).

| Improve this Doc View Source

CreateDirectory()

Creates a new directory within file/stream.

Declaration
public void CreateDirectory()
Remarks

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

| Improve this Doc View Source

CurrentDirectory()

Gets the zero-based index of the current directory.

Declaration
public short CurrentDirectory()
Returns
Type Description
System.Int16

The zero-based index of the current directory.

Remarks

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

| Improve this Doc View Source

CurrentDirOffset()

Retrieves the file/stream offset of the current directory.

Declaration
public long CurrentDirOffset()
Returns
Type Description
System.Int64

The file/stream offset of the current directory.

| Improve this Doc View Source

CurrentRow()

Gets the current row that is being read or written.

Declaration
public int CurrentRow()
Returns
Type Description
System.Int32

The current row that is being read or written.

Remarks

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

| Improve this Doc View Source

CurrentStrip()

Gets the current strip that is being read or written.

Declaration
public int CurrentStrip()
Returns
Type Description
System.Int32

The current strip that is being read or written.

Remarks

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

| Improve this Doc View Source

CurrentTile()

Gets the current tile that is being read or written.

Declaration
public int CurrentTile()
Returns
Type Description
System.Int32

The current tile that is being read or written.

Remarks

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

| Improve this Doc View Source

DataWidth(TiffType)

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

Declaration
public static int DataWidth(TiffType type)
Parameters
Type Name Description
TiffType type

The type.

Returns
Type Description
System.Int32

The number of bytes occupied by the type or 0 if unknown data type is supplied.

| Improve this Doc View Source

DefaultStripSize(Int32)

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

Declaration
public int DefaultStripSize(int estimate)
Parameters
Type Name Description
System.Int32 estimate

The esimated value (may be zero).

Returns
Type Description
System.Int32

The number of rows for a reasonable-sized strip according to the current tag settings and compression-specific requirements.

Remarks

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 ROWSPERSTRIP tag. If there is no any unusual requirements DefaultStripSize tries to create strips that have approximately 8 kilobytes of uncompressed data.

| Improve this Doc View Source

DefaultTileSize(ref Int32, ref Int32)

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

Declaration
public void DefaultTileSize(ref int width, ref int height)
Parameters
Type Name Description
System.Int32 width

The proposed tile width upon the call / tile width to use after the call.

System.Int32 height

The proposed tile height upon the call / tile height to use after the call.

Remarks

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.

| Improve this Doc View Source

Dispose()

Frees and releases all resources allocated by this Tiff.

Declaration
public void Dispose()
| Improve this Doc View Source

Error(Tiff, String, String, Object[])

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

Declaration
public static void Error(Tiff tif, string method, string format, params object[] args)
Parameters
Type Name Description
Tiff tif

An instance of the Tiff class. Can be null.

System.String method

The method where an error is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

Error(String, String, Object[])

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

Declaration
public static void Error(string method, string format, params object[] args)
Parameters
Type Name Description
System.String method

The method where an error is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

ErrorExt(Tiff, Object, String, String, Object[])

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

Declaration
public static void ErrorExt(Tiff tif, object clientData, string method, string format, params object[] args)
Parameters
Type Name Description
Tiff tif

An instance of the Tiff class. Can be null.

System.Object clientData

The client data to be passed to error handler.

System.String method

The method where an error is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

ErrorExt(Object, String, String, Object[])

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

Declaration
public static void ErrorExt(object clientData, string method, string format, params object[] args)
Parameters
Type Name Description
System.Object clientData

The client data to be passed to error handler.

System.String method

The method where an error is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

FieldWithName(String)

Retrieves field information for the tag with specified name.

Declaration
public TiffFieldInfo FieldWithName(string name)
Parameters
Type Name Description
System.String name

The name of the tag to retrieve field information for.

Returns
Type Description
TiffFieldInfo

The field information for specified tag or null if the field information wasn't found.

| Improve this Doc View Source

FieldWithTag(TiffTag)

Retrieves field information for the specified tag.

Declaration
public TiffFieldInfo FieldWithTag(TiffTag tag)
Parameters
Type Name Description
TiffTag tag

The tag to retrieve field information for.

Returns
Type Description
TiffFieldInfo

The field information for specified tag or null if the field information wasn't found.

| Improve this Doc View Source

FileName()

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

Declaration
public string FileName()
Returns
Type Description
System.String

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

Remarks

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, TiffStream) then value of name parameter of ClientOpen(String, String, Object, TiffStream) method is returned.

| Improve this Doc View Source

FindCodec(Compression)

Retrieves the codec registered for the specified compression scheme.

Declaration
public TiffCodec FindCodec(Compression scheme)
Parameters
Type Name Description
Compression scheme

The compression scheme.

Returns
Type Description
TiffCodec

The codec registered for the specified compression scheme or null if there is no codec registered for the given scheme.

Remarks

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.

| Improve this Doc View Source

FindFieldInfo(TiffTag, TiffType)

Retrieves field information for the specified tag.

Declaration
public TiffFieldInfo FindFieldInfo(TiffTag tag, TiffType type)
Parameters
Type Name Description
TiffTag tag

The tag to retrieve field information for.

TiffType type

The tiff data type to use us additional filter.

Returns
Type Description
TiffFieldInfo

The field information for specified tag with specified type or null if the field information wasn't found.

| Improve this Doc View Source

FindFieldInfoByName(String, TiffType)

Retrieves field information for the tag with specified name.

Declaration
public TiffFieldInfo FindFieldInfoByName(string name, TiffType type)
Parameters
Type Name Description
System.String name

The name of the tag to retrieve field information for.

TiffType type

The tiff data type to use us additional filter.

Returns
Type Description
TiffFieldInfo

The field information for specified tag with specified type or null if the field information wasn't found.

| Improve this Doc View Source

Flush()

Flushes pending writes to an open TIFF file.

Declaration
public bool Flush()
Returns
Type Description
System.Boolean

true if succeeded; otherwise, false

Remarks

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.

See Also
FlushData()
| Improve this Doc View Source

FlushData()

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

Declaration
public bool FlushData()
Returns
Type Description
System.Boolean

true if succeeded; otherwise, false

Remarks

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.

See Also
Flush()
| Improve this Doc View Source

FreeDirectory()

Releases storage associated with current directory.

Declaration
public void FreeDirectory()
| Improve this Doc View Source

GetA(Int32)

Gets the A component from ABGR value returned by ReadRGBAImage.

Declaration
public static int GetA(int abgr)
Parameters
Type Name Description
System.Int32 abgr

The ABGR value.

Returns
Type Description
System.Int32

The A component from ABGR value.

| Improve this Doc View Source

GetB(Int32)

Gets the B component from ABGR value returned by ReadRGBAImage.

Declaration
public static int GetB(int abgr)
Parameters
Type Name Description
System.Int32 abgr

The ABGR value.

Returns
Type Description
System.Int32

The B component from ABGR value.

| Improve this Doc View Source

GetBitRevTable(Boolean)

Retrieves a bit reversal table.

Declaration
public static byte[] GetBitRevTable(bool reversed)
Parameters
Type Name Description
System.Boolean reversed

if set to true then bit reversal table will be retrieved; otherwise, the table that do not reverse bit values will be retrieved.

Returns
Type Description
System.Byte[]

The bit reversal table.

Remarks

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.

| Improve this Doc View Source

GetClientInfo(String)

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

Declaration
public object GetClientInfo(string name)
Parameters
Type Name Description
System.String name

Name of the extra information to retrieve.

Returns
Type Description
System.Object

The extra information with specified name associated with this Tiff or null if extra information with specified name was not found.

| Improve this Doc View Source

GetConfiguredCodecs()

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

Declaration
public TiffCodec[] GetConfiguredCodecs()
Returns
Type Description
TiffCodec[]

An array of configured codecs.

| Improve this Doc View Source

GetField(TiffTag)

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

Declaration
public FieldValue[] GetField(TiffTag tag)
Parameters
Type Name Description
TiffTag tag

The tag.

Returns
Type Description
FieldValue[]

The value(s) of a tag in an open TIFF file as array of FieldValue objects or null if there is no such tag set.

Remarks

GetField(TiffTag) 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.

See Also
GetFieldDefaulted(TiffTag)
| Improve this Doc View Source

GetFieldDefaulted(TiffTag)

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).

Declaration
public FieldValue[] GetFieldDefaulted(TiffTag tag)
Parameters
Type Name Description
TiffTag tag

The tag.

Returns
Type Description
FieldValue[]

The value(s) of a tag in an open TIFF file as array of FieldValue objects or null if there is no such tag set and tag has no default value.

Remarks

GetFieldDefaulted(TiffTag) 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.

See Also
GetField(TiffTag)
| Improve this Doc View Source

GetG(Int32)

Gets the G component from ABGR value returned by ReadRGBAImage.

Declaration
public static int GetG(int abgr)
Parameters
Type Name Description
System.Int32 abgr

The ABGR value.

Returns
Type Description
System.Int32

The G component from ABGR value.

| Improve this Doc View Source

GetMode()

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

Declaration
public int GetMode()
Returns
Type Description
System.Int32

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

| Improve this Doc View Source

GetR(Int32)

Gets the R component from ABGR value returned by ReadRGBAImage.

Declaration
public static int GetR(int abgr)
Parameters
Type Name Description
System.Int32 abgr

The ABGR value.

Returns
Type Description
System.Int32

The R component from ABGR value.

| Improve this Doc View Source

GetStream()

Gets the tiff stream.

Declaration
public TiffStream GetStream()
Returns
Type Description
TiffStream

The tiff stream.

| Improve this Doc View Source

GetTagListCount()

Gets the number of elements in the custom tag list.

Declaration
public int GetTagListCount()
Returns
Type Description
System.Int32

The number of elements in the custom tag list.

| Improve this Doc View Source

GetTagListEntry(Int32)

Retrieves the custom tag with specified index.

Declaration
public int GetTagListEntry(int index)
Parameters
Type Name Description
System.Int32 index

The zero-based index of a custom tag to retrieve.

Returns
Type Description
System.Int32

The custom tag with specified index.

| Improve this Doc View Source

GetTagMethods()

Gets the currently used tag methods.

Declaration
public TiffTagMethods GetTagMethods()
Returns
Type Description
TiffTagMethods

The currently used tag methods.

| Improve this Doc View Source

GetVersion()

Gets the library version string.

Declaration
public static string GetVersion()
Returns
Type Description
System.String

The library version string.

| Improve this Doc View Source

IntsToByteArray(Int32[], Int32, Int32, Byte[], Int32)

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

Declaration
public static void IntsToByteArray(int[] source, int srcOffset, int srcCount, byte[] bytes, int offset)
Parameters
Type Name Description
System.Int32[] source

The array of 32-bit values.

System.Int32 srcOffset

The zero-based offset in source at which to begin converting bytes.

System.Int32 srcCount

The number of 32-bit values to convert.

System.Byte[] bytes

The byte array to store converted values at.

System.Int32 offset

The zero-based offset in bytes at which to begin storing converted values.

| Improve this Doc View Source

IsBigEndian()

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

Declaration
public bool IsBigEndian()
Returns
Type Description
System.Boolean

true if given image data was written in big-endian order; otherwise, false.

| Improve this Doc View Source

IsByteSwapped()

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

Declaration
public bool IsByteSwapped()
Returns
Type Description
System.Boolean

true if the image data was in a different byte-order than the host computer or false if the TIFF file/stream and local host byte-orders are the same.

Remarks

Note that ReadTile(Byte[], Int32, Int32, Int32, Int32, Int16), ReadEncodedTile(Int32, Byte[], Int32, Int32), ReadEncodedStrip(Int32, Byte[], Int32, Int32) and methods already normally perform byte swapping to local host order if needed.

Also note that ReadRawTile(Int32, Byte[], Int32, Int32) and ReadRawStrip(Int32, Byte[], Int32, Int32) do not perform byte swapping to local host order.

| Improve this Doc View Source

IsCodecConfigured(Compression)

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

Declaration
public bool IsCodecConfigured(Compression scheme)
Parameters
Type Name Description
Compression scheme

The scheme to check.

Returns
Type Description
System.Boolean

true if the codec is configured and working; otherwise, false.

| Improve this Doc View Source

IsMSB2LSB()

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

Declaration
public bool IsMSB2LSB()
Returns
Type Description
System.Boolean

true if the data is being returned in MSB-to-LSB bit order (i.e with bit 0 as the most significant bit); otherwise, false.

| Improve this Doc View Source

IsTiled()

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

Declaration
public bool IsTiled()
Returns
Type Description
System.Boolean

true if the image data of this Tiff has a tiled organization or false if the image data of this Tiff is organized in strips.

| Improve this Doc View Source

IsUpSampled()

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

Declaration
public bool IsUpSampled()
Returns
Type Description
System.Boolean

true if the data is returned up-sampled; otherwise, false.

Remarks

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).

| Improve this Doc View Source

LastDirectory()

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

Declaration
public bool LastDirectory()
Returns
Type Description
System.Boolean

true if current directory is the last directory in the file; otherwise, false.

| Improve this Doc View Source

Long8ToByteArray(Int64[], Int32, Int32, Byte[], Int32)

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

Declaration
public static void Long8ToByteArray(long[] source, int srcOffset, int srcCount, byte[] bytes, int offset)
Parameters
Type Name Description
System.Int64[] source

The array of 64-bit values.

System.Int32 srcOffset

The zero-based offset in source at which to begin converting bytes.

System.Int32 srcCount

The number of 64-bit values to convert.

System.Byte[] bytes

The byte array to store converted values at.

System.Int32 offset

The zero-based offset in bytes at which to begin storing converted values.

| Improve this Doc View Source

MergeFieldInfo(TiffFieldInfo[], Int32)

Merges given field information to existing one.

Declaration
public void MergeFieldInfo(TiffFieldInfo[] info, int count)
Parameters
Type Name Description
TiffFieldInfo[] info

The array of TiffFieldInfo objects.

System.Int32 count

The number of items to use from the info array.

| Improve this Doc View Source

NumberOfDirectories()

Gets the number of directories in a file.

Declaration
public short NumberOfDirectories()
Returns
Type Description
System.Int16

The number of directories in a file.

| Improve this Doc View Source

NumberOfStrips()

Retrives the number of strips in the image.

Declaration
public int NumberOfStrips()
Returns
Type Description
System.Int32

The number of strips in the image.

| Improve this Doc View Source

NumberOfTiles()

Retrives the number of tiles in the image.

Declaration
public int NumberOfTiles()
Returns
Type Description
System.Int32

The number of tiles in the image.

| Improve this Doc View Source

Open(String, String)

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

Declaration
public static Tiff Open(string fileName, string mode)
Parameters
Type Name Description
System.String fileName

The name of the file to open.

System.String mode

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).

Returns
Type Description
Tiff

The new instance of Tiff class if specified file is successfully opened; otherwise, null.

Remarks

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(Int16) 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(TiffTag, Object[]) 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
lWhen creating a new file force information be written with Little-Endian byte order (but see below).
bWhen creating a new file force information be written with Big-Endian byte order (but see below).
LForce 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.
BForce 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.
HForce image data that is read or written to be treated with bits filled in the same order as the native CPU.
CEnable 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.
cDisable the use of strip chopping when reading images.
hRead 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.
4Create classic TIFF file
8Create BigTIFF file

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 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.

| Improve this Doc View Source

PrintDirectory(Stream)

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

Declaration
public void PrintDirectory(Stream stream)
Parameters
Type Name Description
System.IO.Stream stream

The stream.

| Improve this Doc View Source

PrintDirectory(Stream, TiffPrintFlags)

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

Declaration
public void PrintDirectory(Stream stream, TiffPrintFlags flags)
Parameters
Type Name Description
System.IO.Stream stream

The stream.

TiffPrintFlags flags

The print (formatting) options.

| Improve this Doc View Source

RasterScanlineSize()

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

Declaration
public int RasterScanlineSize()
Returns
Type Description
System.Int32

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

Remarks

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

| Improve this Doc View Source

RawStripSize(Int32)

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

Declaration
public long RawStripSize(int strip)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of a strip.

Returns
Type Description
System.Int64

The number of bytes in a raw strip.

| Improve this Doc View Source

RawTileSize(Int32)

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

Declaration
public long RawTileSize(int tile)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of a tile.

Returns
Type Description
System.Int64

The number of bytes in a raw tile.

| Improve this Doc View Source

ReadBufferSetup(Byte[], Int32)

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

Declaration
public void ReadBufferSetup(byte[] buffer, int size)
Parameters
Type Name Description
System.Byte[] buffer

The data buffer.

System.Int32 size

The buffer size.

Remarks

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.

| Improve this Doc View Source

ReadCustomDirectory(Int64, TiffFieldInfo[], Int32)

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

Declaration
public bool ReadCustomDirectory(long offset, TiffFieldInfo[] info, int count)
Parameters
Type Name Description
System.Int64 offset

The directory offset.

TiffFieldInfo[] info

The array of TiffFieldInfo objects to read from custom directory. Standard TiffFieldInfo objects are ignored.

System.Int32 count

The number of items to use from the info array.

Returns
Type Description
System.Boolean

true if a custom directory was read successfully; otherwise, false

| Improve this Doc View Source

ReadDirectory()

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

Declaration
public bool ReadDirectory()
Returns
Type Description
System.Boolean

true if directory was successfully read; otherwise, false if an error was encountered, or if there are no more directories to be read.

Remarks

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, 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().

| Improve this Doc View Source

ReadEncodedStrip(Int32, Byte[], Int32, Int32)

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.

Declaration
public int ReadEncodedStrip(int strip, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of the strip to read.

System.Byte[] buffer

The buffer to place decompressed strip bytes to.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing decompressed strip bytes.

System.Int32 count

The maximum number of decompressed strip bytes to be stored to buffer.

Returns
Type Description
System.Int32

The actual number of bytes of data that were placed in buffer or -1 if an error was encountered.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip(Int32, Int16) 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 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.

| Improve this Doc View Source

ReadEncodedTile(Int32, Byte[], Int32, Int32)

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.

Declaration
public int ReadEncodedTile(int tile, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of the tile to read.

System.Byte[] buffer

The buffer to place decompressed tile bytes to.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing decompressed tile bytes.

System.Int32 count

The maximum number of decompressed tile bytes to be stored to buffer.

Returns
Type Description
System.Int32

The actual number of bytes of data that were placed in buffer or -1 if an error was encountered.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile(Int32, Int32, Int32, Int16) 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 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.

| Improve this Doc View Source

ReadEXIFDirectory(Int64)

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

Declaration
public bool ReadEXIFDirectory(long offset)
Parameters
Type Name Description
System.Int64 offset

The directory offset.

Returns
Type Description
System.Boolean

true if an EXIF directory was read successfully; otherwise, false

| Improve this Doc View Source

ReadRawStrip(Int32, Byte[], Int32, Int32)

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.

Declaration
public int ReadRawStrip(int strip, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of the strip to read.

System.Byte[] buffer

The buffer to place read bytes to.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing read bytes.

System.Int32 count

The maximum number of read bytes to be stored to buffer.

Returns
Type Description
System.Int32

The actual number of bytes of data that were placed in buffer or -1 if an error was encountered.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip(Int32, Int16) 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(Int32). 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.

| Improve this Doc View Source

ReadRawTile(Int32, Byte[], Int32, Int32)

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.

Declaration
public int ReadRawTile(int tile, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of the tile to read.

System.Byte[] buffer

The buffer to place read tile bytes to.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing read tile bytes.

System.Int32 count

The maximum number of read tile bytes to be stored to buffer.

Returns
Type Description
System.Int32

The actual number of bytes of data that were placed in buffer or -1 if an error was encountered.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile(Int32, Int32, Int32, Int16) 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(Int32). 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.

| Improve this Doc View Source

ReadRGBAImage(Int32, Int32, Int32[])

Reads the image and decodes it into RGBA format raster.

Declaration
public bool ReadRGBAImage(int width, int height, int[] raster)
Parameters
Type Name Description
System.Int32 width

The raster width.

System.Int32 height

The raster height.

System.Int32[] raster

The raster (the buffer to place decoded image data to).

Returns
Type Description
System.Boolean

true if the image was successfully read and converted; otherwise, false is returned if an error was encountered.

Remarks

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 if you want to specify another raster origin.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The GetR(Int32), GetG(Int32), GetB(Int32), and GetA(Int32) 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.

See Also
ReadRGBAStrip(Int32, Int32[])
ReadRGBATile(Int32, Int32, Int32[])
RGBAImageOK(out String)
| Improve this Doc View Source

ReadRGBAImage(Int32, Int32, Int32[], Boolean)

Reads the image and decodes it into RGBA format raster.

Declaration
public bool ReadRGBAImage(int width, int height, int[] raster, bool stopOnError)
Parameters
Type Name Description
System.Int32 width

The raster width.

System.Int32 height

The raster height.

System.Int32[] raster

The raster (the buffer to place decoded image data to).

System.Boolean stopOnError

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.

Returns
Type Description
System.Boolean

true if the image was successfully read and converted; otherwise, false is returned if an error was encountered and stopOnError is false.

Remarks

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 if you want to specify another raster origin.

Raster pixels are 8-bit packed red, green, blue, alpha samples. The GetR(Int32), GetG(Int32), GetB(Int32), and GetA(Int32) 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.

See Also
ReadRGBAStrip(Int32, Int32[])
ReadRGBATile(Int32, Int32, Int32[])
RGBAImageOK(out String)
| Improve this Doc View Source

ReadRGBAImageOriented(Int32, Int32, Int32[], Orientation)

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

Declaration
public bool ReadRGBAImageOriented(int width, int height, int[] raster, Orientation orientation)
Parameters
Type Name Description
System.Int32 width

The raster width.

System.Int32 height

The raster height.

System.Int32[] raster

The raster (the buffer to place decoded image data to).

Orientation orientation

The raster origin position.

Returns
Type Description
System.Boolean

true if the image was successfully read and converted; otherwise, false is returned if an error was encountered.

Remarks

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 .

Raster pixels are 8-bit packed red, green, blue, alpha samples. The GetR(Int32), GetG(Int32), GetB(Int32), and GetA(Int32) 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.

See Also
ReadRGBAStrip(Int32, Int32[])
ReadRGBATile(Int32, Int32, Int32[])
RGBAImageOK(out String)
| Improve this Doc View Source

ReadRGBAImageOriented(Int32, Int32, Int32[], Orientation, Boolean)

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

Declaration
public bool ReadRGBAImageOriented(int width, int height, int[] raster, Orientation orientation, bool stopOnError)
Parameters
Type Name Description
System.Int32 width

The raster width.

System.Int32 height

The raster height.

System.Int32[] raster

The raster (the buffer to place decoded image data to).

Orientation orientation

The raster origin position.

System.Boolean stopOnError

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.

Returns
Type Description
System.Boolean

true if the image was successfully read and converted; otherwise, false is returned if an error was encountered and stopOnError is false.

Remarks

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 .

Raster pixels are 8-bit packed red, green, blue, alpha samples. The GetR(Int32), GetG(Int32), GetB(Int32), and GetA(Int32) 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.

See Also
ReadRGBAStrip(Int32, Int32[])
ReadRGBATile(Int32, Int32, Int32[])
RGBAImageOK(out String)
| Improve this Doc View Source

ReadRGBAStrip(Int32, Int32[])

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

Declaration
public bool ReadRGBAStrip(int row, int[] raster)
Parameters
Type Name Description
System.Int32 row

The row.

System.Int32[] raster

The RGBA raster.

Returns
Type Description
System.Boolean

true if the strip was successfully read and converted; otherwise, false

Remarks

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 (IMAGEWIDTH) and rowsperstrip is the maximum lines in a strip (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 GetR(Int32), GetG(Int32), GetB(Int32), and GetA(Int32) 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 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(Int32, Int32, Int32[]) 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.

See Also
ReadRGBATile(Int32, Int32, Int32[])
RGBAImageOK(out String)
| Improve this Doc View Source

ReadRGBATile(Int32, Int32, Int32[])

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

Declaration
public bool ReadRGBATile(int col, int row, int[] raster)
Parameters
Type Name Description
System.Int32 col

The column.

System.Int32 row

The row.

System.Int32[] raster

The RGBA raster.

Returns
Type Description
System.Boolean

true if the strip was successfully read and converted; otherwise, false

Remarks

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 (TILEWIDTH) and length is the height of a tile (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 GetR(Int32), GetG(Int32), GetB(Int32), and GetA(Int32) 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 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(Int32, Int32[]) 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.

See Also
ReadRGBAStrip(Int32, Int32[])
RGBAImageOK(out String)
| Improve this Doc View Source

ReadScanline(Byte[], Int32)

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

Declaration
public bool ReadScanline(byte[] buffer, int row)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to place read and decoded image data to.

System.Int32 row

The zero-based index of scanline (row) to read.

Returns
Type Description
System.Boolean

true if image data were read and decoded successfully; otherwise, false

Remarks

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[], Int32, Int16) or ReadScanline(Byte[], Int32, Int32, Int16) and specify correct sample plane if image data are organized in separate planes (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 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.

| Improve this Doc View Source

ReadScanline(Byte[], Int32, Int16)

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

Declaration
public bool ReadScanline(byte[] buffer, int row, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to place read and decoded image data to.

System.Int32 row

The zero-based index of scanline (row) to read.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Boolean

true if image data were read and decoded successfully; otherwise, false

Remarks

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[], Int32) or specify 0 for plane parameter if image data is contiguous (i.e not organized in separate planes, 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 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.

| Improve this Doc View Source

ReadScanline(Byte[], Int32, Int32, Int16)

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

Declaration
public bool ReadScanline(byte[] buffer, int offset, int row, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to place read and decoded image data to.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing read and decoded bytes.

System.Int32 row

The zero-based index of scanline (row) to read.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Boolean

true if image data were read and decoded successfully; otherwise, false

Remarks

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[], Int32) or specify 0 for plane parameter if image data is contiguous (i.e not organized in separate planes, 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 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.

| Improve this Doc View Source

ReadTile(Byte[], Int32, Int32, Int32, Int32, Int16)

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

Declaration
public int ReadTile(byte[] buffer, int offset, int x, int y, int z, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to place read and decoded image data to.

System.Int32 offset

The zero-based byte offset in buffer at which to begin storing read and decoded bytes.

System.Int32 x

The x-coordinate of the pixel within a tile to be read and decoded.

System.Int32 y

The y-coordinate of the pixel within a tile to be read and decoded.

System.Int32 z

The z-coordinate of the pixel within a tile to be read and decoded.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Int32

The number of bytes in the decoded tile or -1 if an error occurred.

Remarks

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 IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (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 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.

| Improve this Doc View Source

Realloc(Byte[], Int32)

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

Declaration
public static byte[] Realloc(byte[] array, int size)
Parameters
Type Name Description
System.Byte[] array

The existing array.

System.Int32 size

The number of elements in new array.

Returns
Type Description
System.Byte[]

The new byte array of specified size with data from the existing array.

| Improve this Doc View Source

Realloc(Int32[], Int32)

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

Declaration
public static int[] Realloc(int[] array, int size)
Parameters
Type Name Description
System.Int32[] array

The existing array.

System.Int32 size

The number of elements in new array.

Returns
Type Description
System.Int32[]

The new integer array of specified size with data from the existing array.

Remarks

Size of the array is in elements, not bytes.

| Improve this Doc View Source

RegisterCodec(TiffCodec)

Adds specified codec to a list of registered codec.

Declaration
public void RegisterCodec(TiffCodec codec)
Parameters
Type Name Description
TiffCodec codec

The codec to register.

Remarks

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.

| Improve this Doc View Source

ReverseBits(Byte[], Int32)

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

Declaration
public static void ReverseBits(byte[] buffer, int count)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to replace bytes in.

System.Int32 count

The number of bytes to process.

Remarks

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

| Improve this Doc View Source

ReverseBits(Byte[], Int32, Int32)

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

Declaration
public static void ReverseBits(byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Byte[] buffer

The buffer to replace bytes in.

System.Int32 offset

The zero-based offset in buffer at which to begin processing bytes.

System.Int32 count

The number of bytes to process.

Remarks

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

| Improve this Doc View Source

RewriteDirectory()

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

Declaration
public bool RewriteDirectory()
Returns
Type Description
System.Boolean

true if the current directory was rewritten successfully; otherwise, false

Remarks

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.

| Improve this Doc View Source

RGBAImageOK(out String)

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

Declaration
public bool RGBAImageOK(out string errorMsg)
Parameters
Type Name Description
System.String errorMsg

The error message (if any) gets placed here.

Returns
Type Description
System.Boolean

true if the image can be converted to RGBA format; otherwise, false is returned and errorMsg contains the reason why it is being rejected.

Remarks

To convert the image to RGBA format please use , , ReadRGBAStrip(Int32, Int32[]) or ReadRGBATile(Int32, Int32, Int32[])

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).

| Improve this Doc View Source

ScanlineSize()

Calculates the size in bytes of a row of data as it would be returned in a call to , or as it would be expected in a call to .

Declaration
public int ScanlineSize()
Returns
Type Description
System.Int32

The size in bytes of a row of data.

Remarks

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.

See Also
RasterScanlineSize()
| Improve this Doc View Source

SetClientdata(Object)

Asscociates a custom data with this Tiff.

Declaration
public object SetClientdata(object data)
Parameters
Type Name Description
System.Object data

The data to associate.

Returns
Type Description
System.Object

The previously associated data.

| Improve this Doc View Source

SetClientInfo(Object, String)

Associates extra information with this Tiff.

Declaration
public void SetClientInfo(object data, string name)
Parameters
Type Name Description
System.Object data

The information to associate with this Tiff.

System.String name

The name (label) of the information.

Remarks

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

| Improve this Doc View Source

SetDirectory(Int16)

Sets the directory with specified number as the current directory.

Declaration
public bool SetDirectory(short number)
Parameters
Type Name Description
System.Int16 number

The zero-based number of the directory to set as the current directory.

Returns
Type Description
System.Boolean

true if the specified directory was set as current successfully; otherwise, false

Remarks

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

| Improve this Doc View Source

SetErrorHandler(TiffErrorHandler)

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

Declaration
public static TiffErrorHandler SetErrorHandler(TiffErrorHandler errorHandler)
Parameters
Type Name Description
TiffErrorHandler errorHandler

An instance of the TiffErrorHandler class to set as custom library-wide error and warning handler.

Returns
Type Description
TiffErrorHandler

Previous error handler or null if there was no error handler set.

| Improve this Doc View Source

SetField(TiffTag, Object[])

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

Declaration
public bool SetField(TiffTag tag, params object[] value)
Parameters
Type Name Description
TiffTag tag

The tag.

System.Object[] value

The tag value(s).

Returns
Type Description
System.Boolean

true if tag value(s) were set successfully; otherwise, false.

Remarks

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, 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.

| Improve this Doc View Source

SetFileName(String)

Sets the new ID string for this Tiff.

Declaration
public string SetFileName(string name)
Parameters
Type Name Description
System.String name

The ID string for this Tiff.

Returns
Type Description
System.String

The previous file name or ID string for this Tiff.

Remarks

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.

| Improve this Doc View Source

SetMode(Int32)

Sets the new mode for the underlying file or stream.

Declaration
public int SetMode(int mode)
Parameters
Type Name Description
System.Int32 mode

The new mode for the underlying file or stream.

Returns
Type Description
System.Int32

The previous mode with which the underlying file or stream was opened.

| Improve this Doc View Source

SetSubDirectory(Int64)

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

Declaration
public bool SetSubDirectory(long offset)
Parameters
Type Name Description
System.Int64 offset

The offset from the beginnig of the file/stream to the directory to set as the current directory.

Returns
Type Description
System.Boolean

true if the directory at specified file offset was set as current successfully; otherwise, false

Remarks

SetSubDirectory acts like SetDirectory(Int16), 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).

| Improve this Doc View Source

SetTagExtender(Tiff.TiffExtendProc)

Sets the tag extender method.

Declaration
public static Tiff.TiffExtendProc SetTagExtender(Tiff.TiffExtendProc extender)
Parameters
Type Name Description
Tiff.TiffExtendProc extender

The tag extender method.

Returns
Type Description
Tiff.TiffExtendProc

Previous tag extender method.

Remarks

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

| Improve this Doc View Source

SetTagMethods(TiffTagMethods)

Sets the new tag methods to use.

Declaration
public TiffTagMethods SetTagMethods(TiffTagMethods methods)
Parameters
Type Name Description
TiffTagMethods methods

Tag methods.

Returns
Type Description
TiffTagMethods

The previously used tag methods.

| Improve this Doc View Source

SetupStrips()

Setups the strips.

Declaration
public bool SetupStrips()
Returns
Type Description
System.Boolean

true if setup successfully; otherwise, false

| Improve this Doc View Source

SetWriteOffset(Int64)

Sets the current write offset.

Declaration
public void SetWriteOffset(long offset)
Parameters
Type Name Description
System.Int64 offset

The write offset.

Remarks

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.

| Improve this Doc View Source

ShortsToByteArray(Int16[], Int32, Int32, Byte[], Int32)

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

Declaration
public static void ShortsToByteArray(short[] source, int srcOffset, int srcCount, byte[] bytes, int offset)
Parameters
Type Name Description
System.Int16[] source

The array of 16-bit values.

System.Int32 srcOffset

The zero-based offset in source at which to begin converting bytes.

System.Int32 srcCount

The number of 16-bit values to convert.

System.Byte[] bytes

The byte array to store converted values at.

System.Int32 offset

The zero-based offset in bytes at which to begin storing converted values.

| Improve this Doc View Source

StripSize()

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

Declaration
public int StripSize()
Returns
Type Description
System.Int32

The number of bytes in a row-aligned strip

Remarks

StripSize returns the equivalent size for a strip of data as it would be returned in a call to ReadEncodedStrip(Int32, Byte[], Int32, Int32) or as it would be expected in a call to .

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

| Improve this Doc View Source

SwabArrayOfDouble(Double[], Int32)

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

Declaration
public static void SwabArrayOfDouble(double[] array, int count)
Parameters
Type Name Description
System.Double[] array

The array to swap bytes in.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfDouble(Double[], Int32, Int32)

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

Declaration
public static void SwabArrayOfDouble(double[] array, int offset, int count)
Parameters
Type Name Description
System.Double[] array

The array to swap bytes in.

System.Int32 offset

The zero-based offset in array at which to begin swapping bytes.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfLong(Int32[], Int32)

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

Declaration
public static void SwabArrayOfLong(int[] array, int count)
Parameters
Type Name Description
System.Int32[] array

The array to swap bytes in.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfLong(Int32[], Int32, Int32)

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

Declaration
public static void SwabArrayOfLong(int[] array, int offset, int count)
Parameters
Type Name Description
System.Int32[] array

The array to swap bytes in.

System.Int32 offset

The zero-based offset in array at which to begin swapping bytes.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfLong8(Int64[], Int32)

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

Declaration
public static void SwabArrayOfLong8(long[] array, int count)
Parameters
Type Name Description
System.Int64[] array

The array to swap bytes in.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfLong8(Int64[], Int32, Int32)

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

Declaration
public static void SwabArrayOfLong8(long[] array, int offset, int count)
Parameters
Type Name Description
System.Int64[] array

The array to swap bytes in.

System.Int32 offset

The zero-based offset in array at which to begin swapping bytes.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfShort(Int16[], Int32)

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

Declaration
public static void SwabArrayOfShort(short[] array, int count)
Parameters
Type Name Description
System.Int16[] array

The array to swap bytes in.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfShort(Int16[], Int32, Int32)

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

Declaration
public static void SwabArrayOfShort(short[] array, int offset, int count)
Parameters
Type Name Description
System.Int16[] array

The array to swap bytes in.

System.Int32 offset

The zero-based offset in array at which to begin swapping bytes.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfTriples(Byte[], Int32)

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

Declaration
public static void SwabArrayOfTriples(byte[] array, int count)
Parameters
Type Name Description
System.Byte[] array

The array to swap bytes in.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabArrayOfTriples(Byte[], Int32, Int32)

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

Declaration
public static void SwabArrayOfTriples(byte[] array, int offset, int count)
Parameters
Type Name Description
System.Byte[] array

The array to swap bytes in.

System.Int32 offset

The zero-based offset in array at which to begin swapping bytes.

System.Int32 count

The number of items to swap bytes in.

| Improve this Doc View Source

SwabDouble(ref Double)

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

Declaration
public static void SwabDouble(ref double value)
Parameters
Type Name Description
System.Double value

The value to swap bytes in.

| Improve this Doc View Source

SwabLong(ref Int32)

Swaps the bytes in a single 32-bit item.

Declaration
public static void SwabLong(ref int value)
Parameters
Type Name Description
System.Int32 value

The value to swap bytes in.

| Improve this Doc View Source

SwabShort(ref Int16)

Swaps the bytes in a single 16-bit item.

Declaration
public static void SwabShort(ref short value)
Parameters
Type Name Description
System.Int16 value

The value to swap bytes in.

| Improve this Doc View Source

TileRowSize()

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

Declaration
public int TileRowSize()
Returns
Type Description
System.Int32

The number of bytes in each row of a tile.

| Improve this Doc View Source

TileSize()

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

Declaration
public int TileSize()
Returns
Type Description
System.Int32

The number of bytes in a row-aligned tile.

Remarks

TileSize returns the equivalent size for a tile of data as it would be returned in a call to ReadTile(Byte[], Int32, Int32, Int32, Int32, Int16) or as it would be expected in a call to .

| Improve this Doc View Source

UnlinkDirectory(Int16)

Unlinks the specified directory from the directory chain.

Declaration
public bool UnlinkDirectory(short number)
Parameters
Type Name Description
System.Int16 number

The zero-based number of the directory to unlink.

Returns
Type Description
System.Boolean

true if directory was unlinked successfully; otherwise, false.

Remarks

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

| Improve this Doc View Source

UnRegisterCodec(TiffCodec)

Removes specified codec from a list of registered codecs.

Declaration
public void UnRegisterCodec(TiffCodec codec)
Parameters
Type Name Description
TiffCodec codec

The codec to remove from a list of registered codecs.

| Improve this Doc View Source

VStripSize(Int32)

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

Declaration
public int VStripSize(int rowCount)
Parameters
Type Name Description
System.Int32 rowCount

The number of rows in a strip.

Returns
Type Description
System.Int32

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

| Improve this Doc View Source

VTileSize(Int32)

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

Declaration
public int VTileSize(int rowCount)
Parameters
Type Name Description
System.Int32 rowCount

The number of rows in a tile.

Returns
Type Description
System.Int32

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

| Improve this Doc View Source

Warning(Tiff, String, String, Object[])

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

Declaration
public static void Warning(Tiff tif, string method, string format, params object[] args)
Parameters
Type Name Description
Tiff tif

An instance of the Tiff class. Can be null.

System.String method

The method in which a warning is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

Warning(String, String, Object[])

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

Declaration
public static void Warning(string method, string format, params object[] args)
Parameters
Type Name Description
System.String method

The method in which a warning is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

WarningExt(Tiff, Object, String, String, Object[])

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

Declaration
public static void WarningExt(Tiff tif, object clientData, string method, string format, params object[] args)
Parameters
Type Name Description
Tiff tif

An instance of the Tiff class. Can be null.

System.Object clientData

The client data to be passed to warning handler.

System.String method

The method in which a warning is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

WarningExt(Object, String, String, Object[])

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

Declaration
public static void WarningExt(object clientData, string method, string format, params object[] args)
Parameters
Type Name Description
System.Object clientData

The client data to be passed to warning handler.

System.String method

The method in which a warning is detected.

System.String format

A composite format string (see Remarks).

System.Object[] args

An object array that contains zero or more objects to format.

Remarks

The format is a composite format string that uses the same format as 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(TiffErrorHandler) to override the default error and warning handler.

| Improve this Doc View Source

WriteBufferSetup(Byte[], Int32)

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

Declaration
public void WriteBufferSetup(byte[] buffer, int size)
Parameters
Type Name Description
System.Byte[] buffer

The data buffer.

System.Int32 size

The buffer size.

Remarks

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.

| Improve this Doc View Source

WriteCheck(Boolean, String)

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

Declaration
public bool WriteCheck(bool tiles, string method)
Parameters
Type Name Description
System.Boolean tiles

If set to true then ability to write tiles will be verified; otherwise, ability to write strips will be verified.

System.String method

The name of the calling method.

Returns
Type Description
System.Boolean

true if file/stream is writeable and the directory information is setup properly; otherwise, false

| Improve this Doc View Source

WriteDirectory()

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

Declaration
public bool WriteDirectory()
Returns
Type Description
System.Boolean

true if the current directory was written successfully; otherwise, false

Remarks

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.

| Improve this Doc View Source

WriteEncodedStrip(Int32, Byte[], Int32)

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

Declaration
public int WriteEncodedStrip(int strip, byte[] buffer, int count)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of the strip to write.

System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 count

The maximum number of strip bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of encoded and written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip(Int32, Int16) automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of IMAGELENGTH tag is automatically increased to include the strip (except for PLANARCONFIG = PlanarConfig.SEPARATE, where the IMAGELENGTH tag cannot be changed once the first data are written). If the IMAGELENGTH is increased, the values of STRIPOFFSETS and 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 BITSPERSAMPLE tag greater than 8.

| Improve this Doc View Source

WriteEncodedStrip(Int32, Byte[], Int32, Int32)

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

Declaration
public int WriteEncodedStrip(int strip, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of the strip to write.

System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 offset

The zero-based byte offset in buffer at which to begin reading bytes to be encoded and written.

System.Int32 count

The maximum number of strip bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of encoded and written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip(Int32, Int16) automatically does this when converting an (row, plane) to a strip index.

If there is no space for the strip, the value of IMAGELENGTH tag is automatically increased to include the strip (except for PLANARCONFIG = PlanarConfig.SEPARATE, where the IMAGELENGTH tag cannot be changed once the first data are written). If the IMAGELENGTH is increased, the values of STRIPOFFSETS and 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 BITSPERSAMPLE tag greater than 8.

| Improve this Doc View Source

WriteEncodedTile(Int32, Byte[], Int32)

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

Declaration
public int WriteEncodedTile(int tile, byte[] buffer, int count)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of the tile to write.

System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 count

The maximum number of tile bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of encoded and written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile(Int32, Int32, Int32, Int16) 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 IMAGELENGTH tag must be setup before writing; WriteEncodedTile does not support automatically growing the image on each write (as 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 BITSPERSAMPLE tag greater than 8.

| Improve this Doc View Source

WriteEncodedTile(Int32, Byte[], Int32, Int32)

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

Declaration
public int WriteEncodedTile(int tile, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of the tile to write.

System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 offset

The zero-based byte offset in buffer at which to begin reading bytes to be encoded and written.

System.Int32 count

The maximum number of tile bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of encoded and written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile(Int32, Int32, Int32, Int16) 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 IMAGELENGTH tag must be setup before writing; WriteEncodedTile does not support automatically growing the image on each write (as 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 BITSPERSAMPLE tag greater than 8.

| Improve this Doc View Source

WriteRawStrip(Int32, Byte[], Int32)

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

Declaration
public int WriteRawStrip(int strip, byte[] buffer, int count)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of the strip to write.

System.Byte[] buffer

The buffer with raw image data to be written.

System.Int32 count

The maximum number of strip bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip(Int32, Int16) automatically does this when converting an (row, plane) to a strip index.

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

| Improve this Doc View Source

WriteRawStrip(Int32, Byte[], Int32, Int32)

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

Declaration
public int WriteRawStrip(int strip, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 strip

The zero-based index of the strip to write.

System.Byte[] buffer

The buffer with raw image data to be written.

System.Int32 offset

The zero-based byte offset in buffer at which to begin reading bytes to be written.

System.Int32 count

The maximum number of strip bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeStrip(Int32, Int16) automatically does this when converting an (row, plane) to a strip index.

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

| Improve this Doc View Source

WriteRawTile(Int32, Byte[], Int32)

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

Declaration
public int WriteRawTile(int tile, byte[] buffer, int count)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of the tile to write.

System.Byte[] buffer

The buffer with raw image data to be written.

System.Int32 count

The maximum number of tile bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile(Int32, Int32, Int32, Int16) 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 IMAGELENGTH tag must be setup before writing; WriteRawTile does not support automatically growing the image on each write (as does).

| Improve this Doc View Source

WriteRawTile(Int32, Byte[], Int32, Int32)

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

Declaration
public int WriteRawTile(int tile, byte[] buffer, int offset, int count)
Parameters
Type Name Description
System.Int32 tile

The zero-based index of the tile to write.

System.Byte[] buffer

The buffer with raw image data to be written.

System.Int32 offset

The zero-based byte offset in buffer at which to begin reading bytes to be written.

System.Int32 count

The maximum number of tile bytes to be read from buffer.

Returns
Type Description
System.Int32

The number of written bytes or -1 if an error occurred.

Remarks

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 (PLANARCONFIG = PlanarConfig.SEPARATE). ComputeTile(Int32, Int32, Int32, Int16) 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 IMAGELENGTH tag must be setup before writing; WriteRawTile does not support automatically growing the image on each write (as does).

| Improve this Doc View Source

WriteScanline(Byte[], Int32)

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

Declaration
public bool WriteScanline(byte[] buffer, int row)
Parameters
Type Name Description
System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 row

The zero-based index of scanline (row) to place encoded data at.

Returns
Type Description
System.Boolean

true if image data were encoded and written successfully; otherwise, false

Remarks

WriteScanline encodes and writes to a file at the specified row. Applications should use WriteScanline(Byte[], Int32, Int16) or WriteScanline(Byte[], Int32, Int32, Int16) and specify correct sample plane parameter if image data in a file/stream is organized in separate planes (i.e 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 IMAGELENGTH tag is automatically increased to include the scanline (except for PLANARCONFIG = PlanarConfig.SEPARATE, where the IMAGELENGTH tag cannot be changed once the first data are written). If the IMAGELENGTH is increased, the values of STRIPOFFSETS and 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 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.

| Improve this Doc View Source

WriteScanline(Byte[], Int32, Int16)

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

Declaration
public bool WriteScanline(byte[] buffer, int row, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 row

The zero-based index of scanline (row) to place encoded data at.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Boolean

true if image data were encoded and written successfully; otherwise, false

Remarks

WriteScanline encodes and writes to a file at the specified row and specified sample plane plane. Applications may use WriteScanline(Byte[], Int32) or specify 0 for plane parameter if image data in a file/stream is contiguous (i.e not organized in separate planes, 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 IMAGELENGTH tag is automatically increased to include the scanline (except for PLANARCONFIG = PlanarConfig.SEPARATE, where the IMAGELENGTH tag cannot be changed once the first data are written). If the IMAGELENGTH is increased, the values of STRIPOFFSETS and 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 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.

| Improve this Doc View Source

WriteScanline(Byte[], Int32, Int32, Int16)

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

Declaration
public bool WriteScanline(byte[] buffer, int offset, int row, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 offset

The zero-based byte offset in buffer at which to begin reading bytes.

System.Int32 row

The zero-based index of scanline (row) to place encoded data at.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Boolean

true if image data were encoded and written successfully; otherwise, false

Remarks

WriteScanline encodes and writes to a file at the specified row and specified sample plane plane. Applications may use WriteScanline(Byte[], Int32) or specify 0 for plane parameter if image data in a file/stream is contiguous (i.e not organized in separate planes, 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 IMAGELENGTH tag is automatically increased to include the scanline (except for PLANARCONFIG = PlanarConfig.CONTIG, where the IMAGELENGTH tag cannot be changed once the first data are written). If the IMAGELENGTH is increased, the values of STRIPOFFSETS and 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 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.

| Improve this Doc View Source

WriteTile(Byte[], Int32, Int32, Int32, Int16)

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

Declaration
public int WriteTile(byte[] buffer, int x, int y, int z, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 x

The x-coordinate of the pixel within a tile to be encoded and written.

System.Int32 y

The y-coordinate of the pixel within a tile to be encoded and written.

System.Int32 z

The z-coordinate of the pixel within a tile to be encoded and written.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Int32

The number of encoded and written bytes or -1 if an error occurred.

Remarks

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 IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

A correct value for the IMAGELENGTH tag must be setup before writing; WriteTile does not support automatically growing the image on each write (as does).

| Improve this Doc View Source

WriteTile(Byte[], Int32, Int32, Int32, Int32, Int16)

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

Declaration
public int WriteTile(byte[] buffer, int offset, int x, int y, int z, short plane)
Parameters
Type Name Description
System.Byte[] buffer

The buffer with image data to be encoded and written.

System.Int32 offset

The zero-based byte offset in buffer at which to begin reading bytes to be encoded and written.

System.Int32 x

The x-coordinate of the pixel within a tile to be encoded and written.

System.Int32 y

The y-coordinate of the pixel within a tile to be encoded and written.

System.Int32 z

The z-coordinate of the pixel within a tile to be encoded and written.

System.Int16 plane

The zero-based index of the sample plane.

Returns
Type Description
System.Int32

The number of encoded and written bytes or -1 if an error occurred.

Remarks

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 IMAGEDEPTH > 1). In other cases the value of z is ignored. The plane parameter is used only if data are organized in separate planes (PLANARCONFIG = PlanarConfig.SEPARATE). In other cases the value of plane is ignored.

A correct value for the IMAGELENGTH tag must be setup before writing; WriteTile does not support automatically growing the image on each write (as does).

Implements

System.IDisposable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX