Class DngImage

Class DngImage

Namespace: Aspose.Imaging.FileFormats.Dng
Assembly: Aspose.Imaging.dll (25.2.0)

The API for processing DNG (Digital Negative) image file format used for digital photography needs by providing comprehensive support for raw files and metadata. Designed for use with digital cameras across various manufacturers, it enables developers to manipulate aspects like bits per pixel, extract internal data, and adjust image balance efficiently. With capabilities to update and save image data seamlessly, this API empowers developers to work with DNG files, ensuring high-quality results and versatile processing options.

[JsonObject(MemberSerialization.OptIn)]
public class DngImage : RasterCachedImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata

Inheritance

objectDisposableObjectDataStreamSupporterImageRasterImageRasterCachedImageDngImage

Implements

IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata

Inherited Members

RasterCachedImage.CacheData(), RasterCachedImage.Blend(Point, RasterImage, Rectangle, byte), RasterCachedImage.Resize(int, int, ResizeType), RasterCachedImage.Resize(int, int, ImageResizeSettings), RasterCachedImage.RotateFlip(RotateFlipType), RasterCachedImage.Rotate(float, bool, Color), RasterCachedImage.Crop(Rectangle), RasterCachedImage.Dither(DitheringMethod, int, IColorPalette), RasterCachedImage.Grayscale(), RasterCachedImage.BinarizeFixed(byte), RasterCachedImage.BinarizeOtsu(), RasterCachedImage.BinarizeBradley(double, int), RasterCachedImage.BinarizeBradley(double), RasterCachedImage.AdjustBrightness(int), RasterCachedImage.AdjustContrast(float), RasterCachedImage.AdjustGamma(float, float, float), RasterCachedImage.AdjustGamma(float), RasterCachedImage.OnCached(), RasterCachedImage.OnPaletteChanged(IColorPalette, IColorPalette), RasterCachedImage.IsCached, RasterImage.xmpData, RasterImage.RemoveMetadata(), RasterImage.Save(Stream, ImageOptionsBase, Rectangle), RasterImage.GetModifyDate(bool), RasterImage.Dither(DitheringMethod, int), RasterImage.Dither(DitheringMethod, int, IColorPalette), RasterImage.GetDefaultPixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.GetDefaultRawData(Rectangle, IPartialRawDataLoader, RawDataSettings), RasterImage.GetDefaultArgb32Pixels(Rectangle), RasterImage.GetDefaultRawData(Rectangle, RawDataSettings), RasterImage.GetArgb32Pixel(int, int), RasterImage.GetPixel(int, int), RasterImage.SetArgb32Pixel(int, int, int), RasterImage.SetPixel(int, int, Color), RasterImage.ReadScanLine(int), RasterImage.ReadArgb32ScanLine(int), RasterImage.WriteScanLine(int, Color[]), RasterImage.WriteArgb32ScanLine(int, int[]), RasterImage.LoadPartialArgb32Pixels(Rectangle, IPartialArgb32PixelLoader), RasterImage.LoadPartialPixels(Rectangle, IPartialPixelLoader), RasterImage.LoadArgb32Pixels(Rectangle), RasterImage.LoadArgb64Pixels(Rectangle), RasterImage.LoadPartialArgb64Pixels(Rectangle, IPartialArgb64PixelLoader), RasterImage.LoadPixels(Rectangle), RasterImage.LoadCmykPixels(Rectangle), RasterImage.LoadCmyk32Pixels(Rectangle), RasterImage.LoadRawData(Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.LoadRawData(Rectangle, Rectangle, RawDataSettings, IPartialRawDataLoader), RasterImage.SaveRawData(byte[], int, Rectangle, RawDataSettings), RasterImage.SaveArgb32Pixels(Rectangle, int[]), RasterImage.SavePixels(Rectangle, Color[]), RasterImage.SaveCmykPixels(Rectangle, CmykColor[]), RasterImage.SaveCmyk32Pixels(Rectangle, int[]), RasterImage.SetResolution(double, double), RasterImage.SetPalette(IColorPalette, bool), RasterImage.Resize(int, int, ImageResizeSettings), RasterImage.Rotate(float, bool, Color), RasterImage.Rotate(float), RasterImage.BinarizeFixed(byte), RasterImage.BinarizeOtsu(), RasterImage.BinarizeBradley(double), RasterImage.BinarizeBradley(double, int), RasterImage.Blend(Point, RasterImage, Rectangle, byte), RasterImage.Blend(Point, RasterImage, byte), RasterImage.Grayscale(), RasterImage.AdjustBrightness(int), RasterImage.AdjustContrast(float), RasterImage.AdjustGamma(float, float, float), RasterImage.AdjustGamma(float), RasterImage.GetSkewAngle(), RasterImage.NormalizeAngle(), RasterImage.NormalizeAngle(bool, Color), RasterImage.Filter(Rectangle, FilterOptionsBase), RasterImage.ReplaceColor(Color, byte, Color), RasterImage.ReplaceColor(int, byte, int), RasterImage.ReplaceNonTransparentColors(Color), RasterImage.ReplaceNonTransparentColors(int), RasterImage.ToBitmap(), RasterImage.ReleaseManagedResources(), RasterImage.UpdateMetadata(), RasterImage.UpdateDimensions(int, int), RasterImage.PremultiplyComponents, RasterImage.UseRawData, RasterImage.UpdateXmpData, RasterImage.XmpData, RasterImage.RawIndexedColorConverter, RasterImage.RawCustomColorConverter, RasterImage.RawFallbackIndex, RasterImage.RawDataSettings, RasterImage.UsePalette, RasterImage.RawDataFormat, RasterImage.RawLineSize, RasterImage.IsRawDataAvailable, RasterImage.HorizontalResolution, RasterImage.VerticalResolution, RasterImage.HasTransparentColor, RasterImage.HasAlpha, RasterImage.TransparentColor, RasterImage.ImageOpacity, RasterImage.DataLoader, Image.CanLoad(string), Image.CanLoad(string, LoadOptions), Image.CanLoad(Stream), Image.CanLoad(Stream, LoadOptions), Image.Create(ImageOptionsBase, int, int), Image.Create(Image[]), Image.Create(MultipageCreateOptions), Image.Create(string[], bool), Image.Create(string[]), Image.Create(Image[], bool), Image.GetFileFormat(string), Image.GetFileFormat(Stream), Image.GetFittingRectangle(Rectangle, int, int), Image.GetFittingRectangle(Rectangle, int[], int, int), Image.Load(string, LoadOptions), Image.Load(string), Image.Load(Stream, LoadOptions), Image.Load(Stream), Image.GetProportionalWidth(int, int, int), Image.GetProportionalHeight(int, int, int), Image.RemoveMetadata(), Image.CanSave(ImageOptionsBase), Image.Resize(int, int), Image.Resize(int, int, ResizeType), Image.Resize(int, int, ImageResizeSettings), Image.GetDefaultOptions(object[]), Image.GetOriginalOptions(), Image.ResizeWidthProportionally(int), Image.ResizeHeightProportionally(int), Image.ResizeWidthProportionally(int, ResizeType), Image.ResizeHeightProportionally(int, ResizeType), Image.ResizeWidthProportionally(int, ImageResizeSettings), Image.ResizeHeightProportionally(int, ImageResizeSettings), Image.RotateFlip(RotateFlipType), Image.Rotate(float), Image.Crop(Rectangle), Image.Crop(int, int, int, int), Image.Save(), Image.Save(string), Image.Save(string, ImageOptionsBase), Image.Save(string, ImageOptionsBase, Rectangle), Image.Save(Stream, ImageOptionsBase), Image.Save(Stream, ImageOptionsBase, Rectangle), Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int), Image.SetPalette(IColorPalette, bool), Image.UpdateContainer(Image), Image.GetCanNotSaveMessage(ImageOptionsBase), Image.GetFitRectangle(Rectangle), Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter), Image.GetFitRectangle(Rectangle, int[]), Image.OnPaletteChanged(IColorPalette, IColorPalette), Image.OnPaletteChanging(IColorPalette, IColorPalette), Image.ReleaseManagedResources(), Image.BitsPerPixel, Image.Bounds, Image.Container, Image.Height, Image.Palette, Image.UsePalette, Image.Size, Image.Width, Image.InterruptMonitor, Image.BufferSizeHint, Image.AutoAdjustPalette, Image.HasBackgroundColor, Image.FileFormat, Image.BackgroundColor, DataStreamSupporter.timeout, DataStreamSupporter.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.SaveData(Stream), DataStreamSupporter.ReleaseManagedResources(), DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, DisposableObject.Dispose(), DisposableObject.ReleaseManagedResources(), DisposableObject.ReleaseUnmanagedResources(), DisposableObject.VerifyNotDisposed(), DisposableObject.Disposed, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

This example shows how to load a DNG image from a file, print its properties and save it to PNG.```csharp [C#]

                                                                                                       string dir = "c:\\temp\\";
                                                                                                       using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "test.dng"))
                                                                                                       {
                                                                                                           Aspose.Imaging.FileFormats.Dng.DngImage dngImage = (Aspose.Imaging.FileFormats.Dng.DngImage) image;
                                                                                                           Aspose.Imaging.FileFormats.Dng.Decoder.RawData rawData = dngImage.ImgData;
                                                                                                           Aspose.Imaging.FileFormats.Dng.Decoder.ImageParameters parameters = rawData.ImageDataParameters;
                                                                                                           if (parameters != null)
                                                                                                           {
                                                                                                               System.Console.WriteLine("The camera manufacturer:              {0}", parameters.CameraManufacturer);
                                                                                                               System.Console.WriteLine("The camera model:                     {0}", parameters.Model);
                                                                                                               System.Console.WriteLine("The colors count:                     {0}", parameters.ColorsCount);
                                                                                                               System.Console.WriteLine("The colors description:               {0}", parameters.Description);
                                                                                                               System.Console.WriteLine("The DNG version:                      {0}", parameters.DngVersion);
                                                                                                               System.Console.WriteLine("The number of RAW images in the file: {0}", parameters.RawCount);
                                                                                                               System.Console.WriteLine("The software:                         {0}", parameters.Software);
                                                                                                               System.Console.WriteLine("The order of the color pixels:        {0}", System.Convert.ToString(parameters.Filters, 2));

                                                                                                               string[] translationCfaDng = parameters.TranslationCfaDng;
                                                                                                               if (translationCfaDng != null)
                                                                                                               {
                                                                                                                   System.Console.WriteLine("The translation array for CFA mosaic {0}:", translationCfaDng.Length);
                                                                                                                   foreach (string s in translationCfaDng)
                                                                                                                   {
                                                                                                                       System.Console.WriteLine("- {0}", s);
                                                                                                                   }
                                                                                                               }
                                                                                                           }

                                                                                                           Aspose.Imaging.FileFormats.Dng.Decoder.ImageOtherParameters otherParameters = rawData.ImageOtherParameters;
                                                                                                           if (otherParameters != null)
                                                                                                           {
                                                                                                               System.Console.WriteLine("The aperture:                         {0}", otherParameters.Aperture);
                                                                                                               //System.Console.WriteLine("The author:                           {0}", otherParameters.Artist);
                                                                                                               System.Console.WriteLine("The description:                      {0}", otherParameters.Description);
                                                                                                               System.Console.WriteLine("The focal length:                     {0}", otherParameters.FocalLength);
                                                                                                               System.Console.WriteLine("The ISO sensitivity:                  {0}", otherParameters.IsoSpeed);
                                                                                                               System.Console.WriteLine("The serial number of the image:       {0}", otherParameters.ShotOrder);
                                                                                                               System.Console.WriteLine("The shutter speed:                    {0}", otherParameters.ShutterSpeed);
                                                                                                               System.Console.WriteLine("The date of shooting:                 {0}", System.DateTime.FromFileTime(otherParameters.Timestamp));
                                                                                                           }

                                                                                                           // Export to PNG with default options.
                                                                                                           dngImage.Save(dir + "test.png", new Aspose.Imaging.ImageOptions.PngOptions());
                                                                                                       }

                                                                                                       // The camera manufacturer:              Leica
                                                                                                       // The camera model:                     M8 Digital Camera
                                                                                                       // The colors count:                     3
                                                                                                       // The colors description:               RGBG
                                                                                                       // The DNG version:                      16777216
                                                                                                       // The number of RAW images in the file: 1
                                                                                                       // The software:                         1.107
                                                                                                       // The order of the color pixels:        10110100101101001011010010110100
                                                                                                       // The aperture:                         0
                                                                                                       // The description:                      
                                                                                                       // The focal length:                     50
                                                                                                       // The ISO sensitivity:                  160
                                                                                                       // The serial number of the image:       0
                                                                                                       // The shutter speed:                    12
                                                                                                       // The date of shooting:                 8/3/2007 3:13:49 AM

## Properties

### <a id="Aspose_Imaging_FileFormats_Dng_DngImage_BitsPerPixel"></a> BitsPerPixel

Discover the number of bits per pixel in the image effortlessly with this 
property. Ideal for understanding the image's pixel depth quickly and accurately.

```csharp
public override int BitsPerPixel { get; }

Property Value

int

FileFormat

Identify the file format of your image with this property. Perfect for understanding the format - just straightforward details.

public override FileFormat FileFormat { get; }

Property Value

FileFormat

Height

Retrieve the height of the image with this property. Perfect for determining the vertical size of the image without hassle.

public override int Height { get; }

Property Value

int

ImgData

Manage the image data with this property. Whether you’re retrieving or updating, this property provides seamless access to the image data for efficient manipulation.

public RawData ImgData { get; set; }

Property Value

RawData

Width

Access the width of the image with this property. Ideal for obtaining the horizontal size of the image quickly and efficiently.

public override int Width { get; }

Property Value

int

Methods

SaveData(Stream)

Saves the data.

protected override void SaveData(Stream stream)

Parameters

stream Stream

The stream to save data to.

Exceptions

NotImplementedException

Saving is not supported

UpdateDimensions(int, int)

Updates the image dimensions.

protected override void UpdateDimensions(int newWidth, int newHeight)

Parameters

newWidth int

The new image width.

newHeight int

The new image height.