Class WebpEncoder
- Namespace
- SixLabors.ImageSharp.Formats.Webp
- Assembly
- SixLabors.ImageSharp.dll
Image encoder for writing an image to a stream in the Webp format.
public sealed class WebpEncoder : ImageEncoder, IImageEncoder
- Inheritance
-
WebpEncoder
- Implements
- Inherited Members
Constructors
WebpEncoder()
public WebpEncoder()
Properties
EntropyPasses
Gets the number of entropy-analysis passes (in [1..10]). Defaults to 1.
public int EntropyPasses { get; init; }
Property Value
FileFormat
Gets the webp file format used. Either lossless or lossy. Defaults to lossy.
public WebpFileFormatType? FileFormat { get; init; }
Property Value
FilterStrength
Gets the strength of the deblocking filter, between 0 (no filtering) and 100 (maximum filtering). A value of 0 will turn off any filtering. Higher value will increase the strength of the filtering process applied after decoding the picture. The higher the value the smoother the picture will appear. Typical values are usually in the range of 20 to 50. Defaults to 60.
public int FilterStrength { get; init; }
Property Value
Method
Gets the encoding method to use. Its a quality/speed trade-off (0=fast, 6=slower-better). Defaults to 4.
public WebpEncodingMethod Method { get; init; }
Property Value
NearLossless
Gets a value indicating whether near lossless mode should be used. This option adjusts pixel values to help compressibility, but has minimal impact on the visual quality.
public bool NearLossless { get; init; }
Property Value
NearLosslessQuality
Gets the quality of near-lossless image preprocessing. The range is 0 (maximum preprocessing) to 100 (no preprocessing, the default). The typical value is around 60. Note that lossy with -q 100 can at times yield better results.
public int NearLosslessQuality { get; init; }
Property Value
Quality
Gets the compression quality. Between 0 and 100. For lossy, 0 gives the smallest size and 100 the largest. For lossless, this parameter is the amount of effort put into the compression: 0 is the fastest but gives larger files compared to the slowest, but best, 100. Defaults to 75.
public int Quality { get; init; }
Property Value
SpatialNoiseShaping
Gets the amplitude of the spatial noise shaping. Spatial noise shaping (or sns for short) refers to a general collection of built-in algorithms used to decide which area of the picture should use relatively less bits, and where else to better transfer these bits. The possible range goes from 0 (algorithm is off) to 100 (the maximal effect). Defaults to 50.
public int SpatialNoiseShaping { get; init; }
Property Value
TransparentColorMode
Gets a value indicating whether to preserve the exact RGB values under transparent area. Otherwise, discard this invisible RGB information for better compression. The default value is Clear.
public WebpTransparentColorMode TransparentColorMode { get; init; }
Property Value
UseAlphaCompression
Gets a value indicating whether the alpha plane should be compressed with Webp lossless format. Defaults to true.
public bool UseAlphaCompression { get; init; }
Property Value
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
StreamcancellationToken
CancellationToken
Type Parameters
TPixel