Table of Contents

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

public bool SkipMetadata { get; init; }

Property Value

bool

Methods

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

public Task EncodeAsync<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken = default) where TPixel : unmanaged, IPixel<TPixel>

Parameters

image Image<TPixel>
stream Stream
cancellationToken CancellationToken

Returns

Task

Type Parameters

TPixel

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

public void Encode<TPixel>(Image<TPixel> image, Stream stream) where TPixel : unmanaged, IPixel<TPixel>

Parameters

image Image<TPixel>
stream Stream

Type Parameters

TPixel

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