Table of Contents

Class JpegLosslessOptions

Namespace
Egami.Formats.Jpeg
Assembly
Egami.dll

How a lossless JPEG (T.81 annex H; SOF3, or SOF11 with Arithmetic) is written: no DCT and no quantization, each sample predicted from its neighbors and the difference coded, so the samples come back exactly. Set as Lossless.

public sealed class JpegLosslessOptions
Inheritance
JpegLosslessOptions
Inherited Members

Examples

// Lossless JPEG: the exact samples back, here 16-bit; the predictor is picked for the image unless you name one.
image.As<Rgb16>().Save("duck-lossless.jpg", new JpegWriterOptions { Lossless = new JpegLosslessOptions() });

// Predictor 1 (the sample to the left), arithmetic-coded (SOF11, which only Egami and Richter's libjpeg read).
image.Save("duck-lossless-arithmetic.jpg", new JpegWriterOptions
{
    Lossless = new JpegLosslessOptions { Predictor = 1 },
    Arithmetic = true,
});

Properties

PointTransform

Gets the point transform: the number of low bits dropped from every sample before it is coded, 0 (the default, lossless) to 15. Above 0 the file is smaller but no longer lossless, and the save reports it as a warning. It must be below the precision.

public int PointTransform { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is outside 0 to 15.

Precision

Gets the bits per sample, 2 to 16, or null (the default) for the pixel type's: 8 for 8-bit types, 16 for 16-bit and floating-point ones. Fewer bits than the pixel type holds round the samples, and the save reports it as a warning.

public int? Precision { get; init; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

The value is outside 2 to 16.

Predictor

Gets the predictor, 1 to 7 as T.81 table H.1 numbers them (1 the sample to the left, 2 above, 3 above left, 4 to 7 combinations), or null (the default) to pick the one that codes the image smallest, estimated on rows spread through it; the choice is the same for any thread count.

public int? Predictor { get; init; }

Property Value

int?

Exceptions

ArgumentOutOfRangeException

The value is outside 1 to 7.