Class ImageEncoder
- Namespace
- SixLabors.ImageSharp.Formats
- Assembly
- SixLabors.ImageSharp.dll
Acts as a base class for image encoders. Types that inherit this encoder are required to implement cancellable synchronous encoding operations only.
public abstract class ImageEncoder : IImageEncoder
- Inheritance
-
ImageEncoder
- Implements
- Derived
- Inherited Members
Properties
SkipMetadata
Gets a value indicating whether to ignore decoded metadata when encoding.
public bool SkipMetadata { get; init; }
Property Value
Methods
EncodeAsync<TPixel>(Image<TPixel>, Stream, CancellationToken)
Encodes the image to the specified stream from the Image<TPixel>.
public Task EncodeAsync<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken = default) 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.
Returns
Type Parameters
TPixelThe pixel format.
Encode<TPixel>(Image<TPixel>, Stream)
Encodes the image to the specified stream from the Image<TPixel>.
public void Encode<TPixel>(Image<TPixel> image, Stream stream) where TPixel : unmanaged, IPixel<TPixel>
Parameters
imageImage<TPixel>The Image<TPixel> to encode from.
streamStreamThe Stream to encode the image data to.
Type Parameters
TPixelThe pixel format.
Encode<TPixel>(Image<TPixel>, Stream, CancellationToken)
Encodes the image to the specified stream from the Image<TPixel>.
protected abstract 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.