Hi,
Before buying imaging component I was trying out the temporary version of Aspose.
My requirement is I need to resize high quality images but with same quality. However its happening like the quality also get reduces when it resizes to smaller dimensions. I need flexibility to resize same image different number of times with different sizes.
Please help me with below code to achieve this:
com.aspose.imaging.Image image = null;
try {
image = com.aspose.imaging.Image.load(new FileInputStream(“input.png”));
Aspose.Imaging.CreateOptions.PngCreateOptions createOptions = new Aspose.Imaging.CreateOptions.PngCreateOptions();
com.aspose.imaging.imageoptions.PngOptions createOptions = new com.aspose.imaging.imageoptions.PngOptions();
com.aspose.imaging.Source source = new com.aspose.imaging.sources.FileCreateSource(“input.png”, true);
createOptions.setSource(source);
com.aspose.imaging.Image outimage = com.aspose.imaging.Image.create(createOptions,460,288);
com.aspose.imaging.Graphics graphics = new com.aspose.imaging.Graphics(outimage);
graphics.clear(com.aspose.imaging.Color.getWhite());
graphics.drawImage(image, outimage.getBounds());
outimage.save(“output.png”, new com.aspose.imaging.imageoptions.PngOptions());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Attached are input and output of below code.
Thanks,
Jahir
Hi Jahir,
Thank you for using Aspose products.
I have evaluated your said issue, and I am able to reproduce the similar results on my end while using the latest version of Aspose.Imaging for Java. An investigative ticket has been logged to probe further, and to rectify the problem (if applicable). The ticket Id for your future reference is IMAGING-33726. As soon as we receive any updates from the development end, we will post here.
Please note, there is another way to re-size the images by using Image.resize method. Please check the below provided sample source for your reference.
Java
com.aspose.imaging.Image image = com.aspose.imaging.Image.load(myDir+“input.png”);
image.resize(460,288);
image.save(myDir + “output.png”);
I am afraid that the quality of resultant images even with Image.resize method is similar to your provided sample.
Hi Babar,
I tried that too. But the output is same.
Please let me know if you get any resolution for this because this is one of the reason I need to buy this product.
Thanks,
Jahir
Hi Jahir,
Thank you for your kind response.
I have requested the relevant developer to schedule the investigation of this issue at earliest. As soon as I receive any updates in this regard, I will post here for your reference.
Hi,
Any update on this ?
Hi Jahir,
Thank you for your patience.
Fix for this issue will be part of Aspose.Imaging for Java v2.0.0; that is scheduled for release in first quarter of November 2013.
You may also know that each release of Aspose.Imaging for Java is ported out from an equivalent version of the .NET product. Aspose.Imaging for .NET v2.0.0 has already been released, so I have evaluated your defined scenario with .NET assemblies. The results are far better than what Aspose.Imaging for Java v1.8.0 produced. Please have look at the attachment.
Thanks for the update.
The issues you have found earlier (filed as IMAGING-33726) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
Thanks, I will check.
Hi,
Its still the same issue. I have now Aspose total license but this issue is not resolved.
PFA for the input and output.
com.aspose.imaging.Image image = com.aspose.imaging.Image.load("input.jpg");
image.resize(460,288, com.aspose.imaging.ResizeType.NearestNeighbourResample);
image.save("output.jpg");
Thanks,
Amit
Hi Amit,
String path = myDir + “input.jpg”;
Image image = Image.load(path);
try
{
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
image.save(outputStream, new BmpOptions());
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
Image image2 = Image.load(inputStream);
try
{
image2.resize(460, 288, ResizeType.LanczosResample);
image2.save(myDir + “output.jpg”, new JpegOptions());
}
finally
{
image2.dispose();
}
}
finally
{
image.dispose();
}
Hi Amit,
Hi,
Thanks for your suggestion and workaround. However for our purpose and for what we have bought the Aspose Total license I would like you to please update me when we have direct fix available. This is directly related to one of our business requirements.
Thanks,
Jahir
Hi Jahir,
The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.