Table of Contents

Class JpegLsWriterOptions

Namespace
Egami.Formats.Extended.JpegLs
Assembly
Egami.Formats.Extended.dll

Options for writing JPEG-LS.

public sealed class JpegLsWriterOptions : WriterOptions
Inheritance
JpegLsWriterOptions
Inherited Members

Examples

// Near-lossless: every sample within 2 of the original, for a much smaller file. Restart markers every 64 lines let a
// damaged file be read again from the next one.
using (FileStream near = File.Create("duck-near.jls"))
{
    duck.Save(near, JpegLsFormat.Info, new JpegLsWriterOptions { Near = 2, RestartInterval = 64 });
}

// Lossless with HP's colour transform, which shrinks most photographs further, sample-interleaved.
using (FileStream hp = File.Create("duck-hp1.jls"))
{
    duck.Save(hp, JpegLsFormat.Info, new JpegLsWriterOptions { ColorTransform = JpegLsColorTransform.Hp1, Interleave = JpegLsInterleave.Sample });
}

// 12-bit samples from a 16-bit raster, as medical images often store them.
using Raster<Gray16> scan = duck.As<Gray16>();
using (FileStream twelve = File.Create("scan-12.jls"))
{
    scan.Save(twelve, JpegLsFormat.Info, new JpegLsWriterOptions { BitsPerSample = 12 });
}

Properties

BitsPerSample

Gets the bits of a written sample, 2 to 16, or null for the raster's own: 8, or 16 for 16-bit pixels, or the BitsPerSample of a raster read from JPEG-LS at that depth. Fewer bits round the samples.

public int? BitsPerSample { get; init; }

Property Value

int?

ColorTransform

Gets the colour transform for RGB rasters. Defaults to None, which every JPEG-LS decoder reads; the HP transforms are read by HP's software, CharLS and Egami. Ignored for gray rasters, for None and for near-lossless coding.

public JpegLsColorTransform ColorTransform { get; init; }

Property Value

JpegLsColorTransform

Default

Gets the default options: lossless, line-interleaved, no colour transform.

public static JpegLsWriterOptions Default { get; }

Property Value

JpegLsWriterOptions

Interleave

Gets how the components are interleaved. Line, the default, codes as small as the others and writes as the rows come; None keeps the whole image in memory until the end.

public JpegLsInterleave Interleave { get; init; }

Property Value

JpegLsInterleave

Near

Gets the largest error allowed per sample, 0 to 255 (and at most half the largest sample value): 0, the default, is lossless; 1 to 3 make files much smaller with errors no eye sees. null keeps the value of JpegLsDetails when the raster came from a JPEG-LS file, else 0.

public int? Near { get; init; }

Property Value

int?

RestartInterval

Gets the restart interval in lines, or 0 (the default) for none. Restart markers let a damaged file be read again from the next marker, at a cost of a few bytes each.

public int RestartInterval { get; init; }

Property Value

int