Table of Contents

Class TiffEncoder

Namespace
SixLabors.ImageSharp.Formats.Tiff
Assembly
SixLabors.ImageSharp.dll

Encoder for writing the data image to a stream in TIFF format.

public class TiffEncoder : QuantizingImageEncoder, IImageEncoder
Inheritance
TiffEncoder
Implements
Inherited Members

Constructors

TiffEncoder()

Initializes a new instance of the TiffEncoder class.

public TiffEncoder()

Properties

BitsPerPixel

Gets the number of bits per pixel.

public TiffBitsPerPixel? BitsPerPixel { get; init; }

Property Value

TiffBitsPerPixel?

Compression

Gets the compression type to use.

public TiffCompression? Compression { get; init; }

Property Value

TiffCompression?

CompressionLevel

Gets the compression level 1-9 for the deflate compression mode. Defaults to DefaultCompression.

public DeflateCompressionLevel? CompressionLevel { get; init; }

Property Value

DeflateCompressionLevel?

HorizontalPredictor

Gets a value indicating which horizontal prediction to use. This can improve the compression ratio with deflate or lzw compression.

public TiffPredictor? HorizontalPredictor { get; init; }

Property Value

TiffPredictor?

PhotometricInterpretation

Gets the PhotometricInterpretation to use. Possible options are RGB, RGB with a color palette, gray or BiColor. If no PhotometricInterpretation is specified or it is unsupported by the encoder, RGB will be used.

public TiffPhotometricInterpretation? PhotometricInterpretation { get; init; }

Property Value

TiffPhotometricInterpretation?

Methods

Encode<TPixel>(Image<TPixel>, Stream, CancellationToken)

Encodes the image to the specified stream from the Image<TPixel>.

protected override void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>

Parameters

image Image<TPixel>

The Image<TPixel> to encode from.

stream Stream

The Stream to encode the image data to.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Type Parameters

TPixel

The pixel format.

Remarks

This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.