Image.resize(..) not working

Hey guys,


we are facing a lot of problems with the Imaging Java stack.

We are using the Image library for just resizing. I tried it with Png and Bmp files.

One problem I see is, that if I not manually call flush and close on the stream, a lot of bytes are missing. It would be a good advise, if you are going to save you should close the passed stream.

But this is not my main problem. :wink:


If I call resize I get the following stacktrace with the Bmp:
Exception in thread “main” java.lang.NullPointerException
at com.aspose.imaging.Color.CloneTo(Unknown Source)
at com.aspose.imaging.M.b(Unknown Source)
at com.aspose.imaging.M.a(Unknown Source)
at com.aspose.imaging.fileformats.bmp.BmpImage.resize(Unknown Source)
at com.saperion.sdb.spi.classicconnector.rendering.RenderImageConverter.resize(RenderImageConverter.java:127)
at com.saperion.sdb.spi.classicconnector.rendering.RenderImageConverter.main(RenderImageConverter.java:146)

With the png file:
java.lang.NullPointerException
at com.aspose.imaging.hidden.E.g.a(Unknown Source)
at com.aspose.imaging.M.b(Unknown Source)
at com.aspose.imaging.M.a(Unknown Source)
at com.aspose.imaging.hidden.f.a.a(Unknown Source)
at com.aspose.imaging.fileformats.tiff.TiffImage.resize(Unknown Source)
at com.aspose.imaging.Image.resize(Unknown Source)
at com.saperion.sdb.spi.classicconnector.rendering.RenderImageConverter.resize(RenderImageConverter.java:127)
at com.saperion.sdb.spi.classicconnector.rendering.RenderImageConverter.main(RenderImageConverter.java:145)


Used code:
InputStream imageInputStream = new ByteArrayInputStream(source);
com.aspose.imaging.Image image = Image.load(imageInputStream);

int imageWidth = image.getWidth();

// resize image
double scale = 1.0;
if (maxWidth > 0 && imageWidth > maxWidth) {
scale = (double) maxWidth / imageWidth;
}
image.resize((int)(imageWidth * scale), (int)(image.getHeight() * scale));

image.save(“D:/image_resized.png”, new PngSaveOptions());
out.flush();
out.close();


Any ideas?

Hi Daniel,

Sorry for the inconvenience faced. While using the latest version of Aspose.Imaging i.e. v1.4.0. for java, I have managed to reproduce this issue on my side and also logged the issue in our bug tracking system, the issue ID is IMAGING-33317. I have linked your request to this issue and you will be notified via this thread as soon as it is resolved.

Please feel free to contact us for any further assistance.

Best Regards,

Hey guys,


any news if this bug is fixed?

Thx,
Daniel

Hi Daniel,

Thanks for your inquiry. I regret to share that your reported is not resolved yet. I have requested the development team for ETA and as soon as I get a feedback I will update you via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

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