DngEncoder Class
Immutable settings for DNG encoding (Adobe Digital Negative specification 1.7.1): the image as linear raw data (LinearRaw), with a camera profile whose camera color space is linear BT.709 RGB.
public sealed class DngEncoder : ImageEncoderRemarks
The raw image is the first image file directory, without preview. It stores the samples of the image as they are: 8 or 16-bit integers for integer pixel formats, 32-bit floating-point numbers for RgbaFloat and RgbaHalf pixels. Gray pixel formats are written as a monochrome image (one sample per pixel), the others as three samples per pixel; a DNG raw image has no transparency, so a pixel that is not fully opaque is rejected with an UnsupportedImageFeatureException (flatten the image first). CMYK pixels are not stored.
The samples of an image labeled ColorTransferFunction.Linear are the linear reference values themselves (the white level is the largest sample). The samples of an sRGB image are mapped to linear values by a linearization table (LinearizationTable) of the sRGB transfer function, whose 16-bit output is the precision DNG gives the linear values: the stored samples are exact (DngRawImage.CopyStoredRow), and a reader renders them from the table. Floating-point samples are linear light: such an image must be labeled linear (the default of floating-point images), and its samples must be finite and not negative (clamp the colors first). Samples above 1 keep their values: the white level is then the smallest integer at least as large as the largest sample, and the baseline exposure (BaselineExposure, its base-2 logarithm) brings it back to 1.
The camera profile says that the camera color space is linear RGB with the primaries of BT.709 and the D65 white point (ColorMatrix1 and ForwardMatrix1 of that space for the D65 illuminant, and a neutral white balance), so that a DNG reader renders the colors of the image. Image.Load renders them back to RgbaFloat pixels in linear light, within the precision of the rational numbers of the matrices.
The orientation is written as the orientation of the raw image, and an XMP packet as its XMP tag. An ICC profile, a CICP description other than one equivalent to sRGB, EXIF, a resolution and text entries follow ImageEncoder.MetadataHandling (rejected by default). The file is a TIFF file whose image file directory is written after the image data, so the destination must be seekable.
A DNG file stores one image: animated images and images with a poster frame are rejected with an UnsupportedImageFeatureException; use ImageFrame.Save to save one frame explicitly. ImageMetadata.DngProperties is ignored.
- Inheritance
ImageEncoderDngEncoder
Constructors
| Name | Description |
|---|---|
| DngEncoder() |
DngEncoder()
public DngEncoder()No documentation is available.
Properties
| Name | Description |
|---|---|
| Compression | Gets the compression of the raw image, or null (the default) for lossless JPEG with integer samples and Deflate with floating-point samples. |
| Format | Gets the format produced by this encoder. |
| TileSize | Gets the width and height of the tiles of the raw image, a multiple of 16, or null (the default) for tiles of 256 pixels with lossless JPEG and strips of about 64 KiB otherwise. |
Compression
DngEncoder.csGets the compression of the raw image, or null (the default) for lossless JPEG with integer samples and Deflate with floating-point samples.
public DngCompression? Compression { get; init; }Property value
Exceptions
ArgumentOutOfRangeException- The value is not a defined
DngCompression.
Remarks
Lossless JPEG stores integer samples and Deflate floating-point ones: another combination is rejected with an UnsupportedImageFeatureException before anything is written.
Format
DngEncoder.csTileSize
DngEncoder.csGets the width and height of the tiles of the raw image, a multiple of 16, or null (the default) for tiles of 256 pixels with lossless JPEG and strips of about 64 KiB otherwise.
public int? TileSize { get; init; }Property value
Exceptions
ArgumentOutOfRangeException- The value is not a positive multiple of 16, or is larger than 65,536.
Remarks
A tile is never larger than the image: the tiles of an image narrower or shorter than this size have its width or height, as the DNG SDK writes them.