Image resizing issues

Hi,


I have a lot of resizing issues.

1. Quality is lost when I resize the image using either LanczosResample or NearestNeighbourResample.
I try generate JPEG thumbnails but they look awful. The original JPEG is generated from a Word document using Aspose.Words and it’s quality is very good.

Image image = Image.load(jpegFile.getAbsolutePath());
JpegOptions jpgOptions = new JpegOptions();
image.resize((int) (width * ratio), (int) (height * ratio), ResizeType.LanczosResample);
image.save(jpegThFile.getAbsolutePath(), jpgOptions);

2. When I try to convert resize a PNG file with LanczosResample I get a black image:

Image image = Image.load(pngFile.getAbsolutePath());
PngOptions pngOptions = new PngOptions();
image.resize((int) (width * ratio), (int) (height * ratio), ResizeType.LanczosResample);
image.save(pngFile.getAbsolutePath(), pngOptions);

3. When I try to save an image as PDF I get an exception that this is not supported. Why in that case there is an option to save as PDF?

Image image = Image.load(file.getAbsolutePath());
PdfOptions pdfOptions = new PdfOptions();
image.save(pdfFile.getAbsolutePath(), pdfOptions);

Thanks in advance for any help with that.
Regards,
Mariusz

Hi Mariusz,


Thank you for contacting Aspose support.

Please find the answers to your inquires in same sequence as of questions.

  1. I am afraid, I am unable to replicate the problem of Jpeg image quality while re-sizing one of my own samples with Aspose.Imaging for Java 2.1.0. In order to investigate this matter further, I would request you to please provide us your sample image(s) along with the results produced on your end.
  2. Thank you for bringing this issue to our knowledge as I am able to replicate the problem with v2.1.0 of Aspose.Imaging for Java. The resultant PNG came blank after performing re-sizing on it. A ticket with Id IMAGING-34085 has been logged in our bug tracking system to properly analyze the cause, and to provide a fix at earliest. We will keep you posted with updates in this regard.
  3. You cannot convert raster images to PDF format while using Aspose.Imaging for Java API. The PdfOptions class is used to convert DXF (AutoCAD format) to PDF only. If you wish to convert raster image formats to PDF, you may have to consider using Aspose.Pdf API for this purpose. If you like, I can share code snippets in order to help achieve your goals.

Please feel free to write back in case you have further questions or concerns.

ad 1. I’m attaching files that describes the issue. Original file quality is very good, it is generated with Aspose.Words from a DOCX file. I resized the file manually with some desktop software and it looks very nice. Unfortunately the file resized with Aspose.Imaging for Java looks really bad.


Thanks in advance for any help,
Mariusz

Hi Mariusz,


Thank you for providing the sample images for our review.

I’m able to see the decrease in quality when re-sizing your provided Jpeg image. For further investigation and correction purposes, I have logged a ticket IMAGING-34086 in our bug tracking system. Please spare us little time for proper analysis. In the meanwhile, we will keep you posted with updates in this regard. Especially, if we have a workaround for this situation, we will post here so you could keep on working until a fix is published.

We are sorry for the inconvenience.

Hi Mariusz,


Thank you for your patience with us.

This is update you that we have fixed the problem logged earlier as IMAGING-34085 (Re-sizing a PNG results in a Blank Image) in our bug tracking system. The fix will be published with the upcoming release of Aspose.Imaging for Java 2.4.0 that is scheduled for the 2nd week of November 2014. As soon as the said release if available for public use, you will be automatically notified here with the download link to the upgraded API.

The other ticket attached to this thread is IMAGING-34086 (Bad Jpeg Quality after Re-size), This issue requires the fixing in the .NET version of the Aspose.Imaging API first then we will be able to port the fix to publish it for Java version of the API. We will keep you posted with updates in this regard.

The issues you have found earlier (filed as IMAGING-34085) 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 IMAGING-34086) 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.