Losing DPI During Image Type Conversion

We have purchased Aspose.Imaging for image conversion. I'm trying to convert 300dpi source documents (BMP and PNG) to TIF images. But no matter what code path I try, the 300dpi is lost and everything gets changed to 96dpi. Even if I just open a 300dpi BMP and save it back out as a BMP or PNG it still switches to 96dpi.

Ultimately, I need to convert the documents to 1bpp bitonal black and white. Losing 66% of the DPI is WAY too much fidelity loss in the final graphic! What can I do to retain the 300dpi?

UPDATE: Simply loading a 300dpi image into an Aspose.Imaging.Image object reports that the document is 96dpi. So before I ever even do anything with the document, I've already lost the fidelity!

Hi there,

Thank you for using Aspose products, and welcome to the Aspose.Imaging support forum.

I believe you are using some older version of the product, therefore I would request you to please download and use the latest version, that is v2.0.0. I have checked your scenarios with the said version, I am afraid; I cannot reproduce any of your mentioned problems.

Please note, you can explicitly specify the Xresolution and Yresolution while converting any image type to Tiff format. Afterwards, you may verify the resolution of your resultant image by checking the image properties via Windows Explorer or any other image viewing tool. Please check the below provided source sample for your reference.

C#


//Load an image for conversion
using (var image = (RasterImage)Aspose.Imaging.Image.Load(myDir + “Aluminum.bmp”))
{
var options = new Aspose.Imaging.ImageOptions.TiffOptions();
//Specify the ResolutionUnit
options.ResolutionUnit = Aspose.Imaging.FileFormats.Tiff.Enums.TiffResolutionUnits.Inch;
//Specify Xresolution
options.Xresolution = new Aspose.Imaging.FileFormats.Tiff.TiffRational(300);
//Specify Yresolution
options.Yresolution = new Aspose.Imaging.FileFormats.Tiff.TiffRational(300);
//Save the result
image.Save(myDir + “output.tiff”, options);
}


I have also verified on my end that loading an image with Aspose.Imaging component, and saving it back to the same format does not change the resolution of the resultant image. Although, if I save a 300DPI Bitmap image to Tiff format and load back the result (a Tiff file) as an object of RasterImage, Aspose.Imaging component reads the resolution to be 96DPI. Whereas the actual resolution of that image remains 300DPI (verified via Windows Explorer). I am still looking into this matter, and I will log ticket for investigative purposes, if required.

Please give a try to our latest version and the sample code shared above. In case you still face any difficluties, please share your sample images along with your source code for our review.
babar.raza:

Although, if I save a 300DPI Bitmap image to Tiff format and load back the result (a Tiff file) as an object of RasterImage, Aspose.Imaging component reads the resolution to be 96DPI. Whereas the actual resolution of that image remains 300DPI (verified via Windows Explorer). I am still looking into this matter, and I will log ticket for investigative purposes, if required.


Hi there,

In reference to my above remarks, I have tested that Aspose.Imaging component's behavior is consistent with Tiff images even having different resolutions, that is; when a Tiff image is loaded in an object of RasterImage, the resolution calculated by Aspose.Imaging is always 96. I have logged a ticket (IMAGING-33737) in our bug tracking system for investigative purposes.

We will keep you posted with updates on this.

The issues you have found earlier (filed as IMAGING-33737) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.