Manipulating DNG Images
Converting DNG to JPEG
Aspose.Imaging for Java provides the DngImage class to load DNG files and same can be used to convert the DNG to raster formats. The following code snippet shows how to convert a DNG file to JPEG format.
// For complete examples and data files, please go to https://github.com/Muhammad-Adnan-Ahmad/Aspose.Imaging-for-Java | |
//Declare variables to store file paths for input and output images. | |
String sourceFiles = "Path_to_source_folder\\Source\\HDR - 3c.dng"; | |
String destPath = "Path_to_results_folder\\Results\\result.jpg"; | |
// Create an instance of Image class and load an exiting DNG file. | |
// Convert the image to DngImage object. | |
com.aspose.imaging.fileformats.dng.DngImage objimage = (com.aspose.imaging.fileformats.dng.DngImage) | |
com.aspose.imaging.Image.load(sourceFiles); | |
// Create an instance of JpegOptions class. | |
// convert and save to disk in Jpeg file format. | |
objimage.save(destPath, new com.aspose.imaging.imageoptions.JpegOptions()); | |
Accessing DNG Properties
Aspose.Imaging for Java provides the DngImage class to load DNG files and access different properties of a DNG image. The following code snippet shows how DNG image information/properties can be accessed.
// For complete examples and data files, please go to https://github.com/Muhammad-Adnan-Ahmad/Aspose.Imaging-for-Java | |
//Declare variables to store file path for input image. | |
String sourceFiles = "Path_to_source_folder\\Source\\HDR - 3c.dng"; | |
// Create an instance of Image class and load an exiting DNG file. | |
// Convert the image to DngImage object. | |
com.aspose.imaging.fileformats.dng.DngImage objimage = (com.aspose.imaging.fileformats.dng.DngImage) | |
com.aspose.imaging.Image.load(sourceFiles); | |
System.out.println("Camera model:" + objimage.getImgData().getImageDataParameters().getModel()); | |
System.out.println("Camera manufacturer:" + objimage.getImgData().getImageDataParameters().getCameraManufacturer()); | |
System.out.println("Software:" + objimage.getImgData().getImageDataParameters().getSoftware()); | |
System.out.println("Colors count:" + objimage.getImgData().getImageDataParameters().getColorsCount()); | |
System.out.println("Artist:" + objimage.getImgData().getImageOtherParameters().getArtist()); | |
System.out.println("Aperture:" + objimage.getImgData().getImageOtherParameters().getAperture()); | |
System.out.println("Focal length:" + objimage.getImgData().getImageOtherParameters().getFocalLength()); | |
System.out.println("Iso speed:" + objimage.getImgData().getImageOtherParameters().getIsoSpeed()); | |