Table of Contents

Class JpegDetails

Namespace
Egami.Formats.Jpeg
Assembly
Egami.dll

Facts about a decoded JPEG that have no general home in RasterMetadata. Read-only facts; not written.

public sealed class JpegDetails : FormatDetails
Inheritance
JpegDetails
Inherited Members

Examples

using Raster photo = Raster.Load("duck.jpg", options: new JpegReaderOptions { FastUpsampling = true });
JpegDetails details = (JpegDetails)photo.Metadata.FormatDetails!;
Console.WriteLine($"{details.ColorSpace}, progressive: {details.Progressive}, quality about {details.EstimatedQuality}");
foreach (JpegComponent component in details.Components)
{
    Console.WriteLine($"Component {component.Id}: sampled {component.HorizontalSampling} × {component.VerticalSampling}");
}

// Gray output, and 4:4:4 (no chroma subsampling) for sharp colored edges.
photo.Save("gray.jpg", new JpegWriterOptions { ColorType = JpegColorType.Gray });
photo.Save("sharp.jpg", new JpegWriterOptions { Quality = 90, Subsampling = ChromaSubsampling.Subsample444 });

Properties

Arithmetic

Gets or sets whether the file is arithmetic-coded rather than Huffman-coded.

public bool Arithmetic { get; set; }

Property Value

bool

ColorSpace

Gets or sets the color model the components are stored in.

public JpegColorSpace ColorSpace { get; set; }

Property Value

JpegColorSpace

Components

Gets the components, in frame order, with their sampling factors (for example 2×2, 1×1, 1×1 for 4:2:0).

public IList<JpegComponent> Components { get; }

Property Value

IList<JpegComponent>

EstimatedQuality

Gets or sets the IJG quality (1 to 100) whose scaled Annex K table is closest to the file's luma quantization table, or null when the file has no such table. An estimate: encoders with their own tables have no true quality.

public int? EstimatedQuality { get; set; }

Property Value

int?

ExtendedXmp

Gets or sets the extended XMP packet (the part that did not fit in one segment), joined from its segments, or empty. The main packet is in Xmp.

public ReadOnlyMemory<byte> ExtendedXmp { get; set; }

Property Value

ReadOnlyMemory<byte>

Lossless

Gets or sets whether the file is lossless JPEG (predicted samples, no DCT), as in DNG tiles and DICOM.

public bool Lossless { get; set; }

Property Value

bool

MultiPicture

Gets or sets the file's Multi-Picture Format index (APP2 "MPF"), which lists the images stored after the primary one, such as previews, stereo views or a gain map; null when the file has none. The JPEG writer does not write it.

public MpfData? MultiPicture { get; set; }

Property Value

MpfData

PhotoshopResources

Gets or sets the Photoshop image resource block (APP13 "Photoshop 3.0"), joined from its segments, or empty. Egami parses only its IPTC resource, into Iptc; on save the IPTC resource is replaced by the current IPTC, its digest (0x0425) is updated to match, and every other resource is written back as it was.

public ReadOnlyMemory<byte> PhotoshopResources { get; set; }

Property Value

ReadOnlyMemory<byte>

Precision

Gets or sets the sample precision in bits: 8 or 12 for DCT files, 2 to 16 for lossless ones.

public int Precision { get; set; }

Property Value

int

Progressive

Gets or sets whether the file is progressive rather than baseline (sequential).

public bool Progressive { get; set; }

Property Value

bool

RestartInterval

Gets or sets the restart interval in MCUs, or 0 for none.

public int RestartInterval { get; set; }

Property Value

int

ScaleDenominator

Gets or sets the scale the pixels were decoded at: 1, 2, 4 or 8 for full size, 1/2, 1/4 or 1/8.

public int ScaleDenominator { get; set; }

Property Value

int

Methods

Copy()

Returns a deep copy.

public override FormatDetails Copy()

Returns

FormatDetails

The copy.