Class PngEncoder
- Namespace
- SixLabors.ImageSharp.Formats.Png
- Assembly
- SixLabors.ImageSharp.dll
Image encoder for writing image data to a stream in png format.
public class PngEncoder : QuantizingAnimatedImageEncoder, IImageEncoder, IQuantizingImageEncoder, IAnimatedImageEncoder
- Inheritance
-
PngEncoder
- Implements
- Inherited Members
Properties
BitDepth
Gets the number of bits per sample or per palette index (not per pixel). Not all values are allowed for all ColorType values.
public PngBitDepth? BitDepth { get; init; }
Property Value
ChunkFilter
Gets the chunk filter method. This allows to filter ancillary chunks.
public PngChunkFilter? ChunkFilter { get; init; }
Property Value
ColorType
Gets the color type.
public PngColorType? ColorType { get; init; }
Property Value
CompressionLevel
Gets the compression level 1-9.
public PngCompressionLevel CompressionLevel { get; init; }
Property Value
- PngCompressionLevel
FilterMethod
Gets the filter method.
public PngFilterMethod? FilterMethod { get; init; }
Property Value
Gamma
Gets the gamma value, that will be written the image.
public float? Gamma { get; init; }
Property Value
- float?
The gamma value of the image.
InterlaceMethod
Gets a value indicating whether this instance should write an Adam7 interlaced image.
public PngInterlaceMode? InterlaceMethod { get; init; }
Property Value
TextCompressionThreshold
Gets the threshold of characters in text metadata, when compression should be used.
public int TextCompressionThreshold { get; init; }
Property Value
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
imageImage<TPixel>The Image<TPixel> to encode from.
streamStreamThe Stream to encode the image data to.
cancellationTokenCancellationTokenThe token to monitor for cancellation requests.
Type Parameters
TPixelThe pixel format.
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.