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
Constructors
ImageEncoder()
protected ImageEncoder()
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
image
Image<TPixel>The Image<TPixel> to encode from.
stream
StreamThe Stream to encode the image data to.
cancellationToken
CancellationTokenThe token to monitor for cancellation requests.
Returns
Type Parameters
TPixel
The 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
image
Image<TPixel>The Image<TPixel> to encode from.
stream
StreamThe Stream to encode the image data to.
Type Parameters
TPixel
The 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
image
Image<TPixel>The Image<TPixel> to encode from.
stream
StreamThe Stream to encode the image data to.
cancellationToken
CancellationTokenThe 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.