Table of Contents

Class JpegEncoder

Namespace
SixLabors.ImageSharp.Formats.Jpeg
Assembly
SixLabors.ImageSharp.dll

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

public sealed class JpegEncoder : ImageEncoder, IImageEncoder
Inheritance
JpegEncoder
Implements
Inherited Members

Constructors

JpegEncoder()

public JpegEncoder()

Properties

ColorType

Gets the jpeg color for encoding.

public JpegEncodingColor? ColorType { get; init; }

Property Value

JpegEncodingColor?

Interleaved

Gets the component encoding mode.

public bool? Interleaved { get; init; }

Property Value

bool?

Remarks

Interleaved encoding mode encodes all color components in a single scan. Non-interleaved encoding mode encodes each color component in a separate scan.

Quality

Gets the quality, that will be used to encode the image. Quality index must be between 1 and 100 (compression from max to min). Defaults to 75.

public int? Quality { get; init; }

Property Value

int?

Exceptions

ArgumentException

Quality factor must be in [1..100] range.

Methods

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

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

Parameters

image Image<TPixel>
stream Stream
cancellationToken CancellationToken

Type Parameters

TPixel