We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

image.getFileFormat() returns 0 for PngImage

There seems to be a bug in Aspose Imaging 17.11.0 for Java.

Loading an image with

Image image = Image.load(inputStream);

and then querying the fileformat with

image.getFileFormat()

works for JPEG images but fails for PNG images, as getFileFormat() returns 0 instead of the correct identification number. Despite of that the image can be read and is correctly created. Please see attached image from debugger.

PastedGraphic-1.png (73.5 KB)

@thomas.winklehner,

I have observed the information shared by you and request you to please share the working sample code along with source file reproducing the issue. We will investigate the issue further on our end to help you out on provision of requested information.

As I wrote before, the sample code to reproduce the issue:

InputStream inputStream = new FileInputStream("1509720284.png");
Image image = Image.load(inputStream);
System.out.println(image.getFileFormat());

File to reproduce: Any PNG!

1509720284.png (82.8 KB)

@thomas.winklehner,

I have worked with files shared by you using Aspose.Imaging for Java 17.11 and have been able to observe the issue. A ticket with ID IMAGINGJAVA-836 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.

Fixed in 17.12.

@thomas.winklehner,

Thank you for sharing feedback.

The issues you have found earlier (filed as IMAGINGJAVA-836) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz