Class RawFormat
Camera RAW files: the sensor data a camera recorded, developed into an image on load. Reads DNG (Adobe's open RAW format, which phones, Leica, Pentax, Ricoh, Hasselblad and Adobe DNG Converter write). Load develops the image with the file's own white balance and colour data; RawReaderOptions picks an embedded preview, a half-size develop or the untouched sensor mosaic instead, and sets the develop. Registered with WithRaw(EgamiContext), which places it ahead of TIFF, since DNG files are TIFF files.
public static class RawFormat
- Inheritance
-
RawFormat
- Inherited Members
Examples
// RAW goes ahead of TIFF, since a DNG is a TIFF file; WithExtendedFormats() registers it too.
EgamiContext context = EgamiContext.Default.WithRaw();
// Load develops the sensor data: the camera's white balance and colour, AHD demosaicing, sRGB in Rgb16.
using Raster photo = Raster.Load("photo.dng", context);
photo.Save("photo.png");
// Probe reads the structure alone: the developed size, the camera and the embedded previews.
RasterInfo info = Raster.Probe("photo.dng", context);
Console.WriteLine($"{info.Width}×{info.Height}, {info.ImageCount} image(s)");
Properties
Info
Gets the format's registration: name, MIME types, extensions, signature and reader.
public static FormatInfo Info { get; }
Property Value
Methods
ConvertToDng(Stream, Stream, DngWriterOptions?, EgamiContext?)
Converts a RAW file to DNG, from one stream to another. See ConvertToDng(string, string, DngWriterOptions?, EgamiContext?).
public static void ConvertToDng(Stream input, Stream output, DngWriterOptions? options = null, EgamiContext? context = null)
Parameters
inputStreamThe RAW file, from its current position. It is left open.
outputStreamWhere to write the DNG. It is left open.
optionsDngWriterOptionsHow to write, or null for the defaults.
contextEgamiContext
Examples
// Any RAW file Egami reads becomes a DNG with its sensor data unchanged: levels, crop, colour data and EXIF come along.
RawFormat.ConvertToDng("photo.dng", "copy.dng", new DngWriterOptions { Preview = DngPreview.Thumbnail }, context);
// A transcode with no operations takes the same route; with operations, the develop is saved as a linear DNG.
Raster.Transcode("photo.dng", "same.dng", context: context);
Raster.Transcode("photo.dng", "small.dng", ops => ops.Fit(800, 800), context: context);
Exceptions
- ArgumentNullException
inputoroutputis null.- NotSupportedException
The file's raw data is of a kind DNG writing does not take.
- CorruptDataException
The file is damaged.
ConvertToDng(string, string, DngWriterOptions?, EgamiContext?)
Converts a RAW file to DNG, keeping its sensor data as decoded: not demosaiced, scaled or cropped. The levels, areas, colour filter pattern and opcodes come from the file, the colour profile from the file or Egami's camera table, and EXIF, XMP and the maker note (in DNGPrivateData) come along. A DNG source keeps every tag it had. A camera with no colour data anywhere gets the profile Egami develops it with, and a warning through Diagnostics.
public static void ConvertToDng(string inputPath, string outputPath, DngWriterOptions? options = null, EgamiContext? context = null)
Parameters
inputPathstringThe RAW file.
outputPathstringThe DNG file to write.
optionsDngWriterOptionsHow to write, or null for the defaults.
contextEgamiContext
Examples
// Any RAW file Egami reads becomes a DNG with its sensor data unchanged: levels, crop, colour data and EXIF come along.
RawFormat.ConvertToDng("photo.dng", "copy.dng", new DngWriterOptions { Preview = DngPreview.Thumbnail }, context);
// A transcode with no operations takes the same route; with operations, the develop is saved as a linear DNG.
Raster.Transcode("photo.dng", "same.dng", context: context);
Raster.Transcode("photo.dng", "small.dng", ops => ops.Fit(800, 800), context: context);
Exceptions
- ArgumentNullException
inputPathoroutputPathis null.- NotSupportedException
The file's raw data is of a kind DNG writing does not take.
- CorruptDataException
The file is damaged.