Class JpegEncoder
Encoder for writing the data image to a stream in jpeg format.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Formats.Jpeg
Assembly: SixLabors.ImageSharp.dll
Syntax
public sealed class JpegEncoder : ImageEncoder, IImageEncoder
Properties
| Edit this page View SourceColorType
Gets the jpeg color for encoding.
Declaration
public JpegEncodingColor? ColorType { get; init; }
Property Value
Type | Description |
---|---|
JpegEncodingColor? |
Interleaved
Gets the component encoding mode.
Declaration
public bool? Interleaved { get; init; }
Property Value
Type | Description |
---|---|
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
Declaration
public int? Quality { get; init; }
Property Value
Type | Description |
---|---|
int? |
Exceptions
Type | Condition |
---|---|
ArgumentException | Quality factor must be in [1..100] range. |
Methods
| Edit this page View SourceEncode<TPixel>(Image<TPixel>, Stream, CancellationToken)
Encodes the image to the specified stream from the Image<TPixel>.
Declaration
protected override void Encode<TPixel>(Image<TPixel> image, Stream stream, CancellationToken cancellationToken) where TPixel : unmanaged, IPixel<TPixel>
Parameters
Type | Name | Description |
---|---|---|
Image<TPixel> | image | 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
Name | Description |
---|---|
TPixel | The pixel format. |
Overrides
Remarks
This method is designed to support the ImageSharp internal infrastructure and is not recommended for direct use.