Exception"Xml content not provided" while loading PNG images (Java)

Aspose.Imaging version: 17.12.

The attached image fails to load and throws an error.

tin.png (648.9 KB)

@thomas.winklehner,

I have worked with PNG file shared by you using Aspose.Imaging for Java 17.12 on my end in Windows 7 x64 with JDK 1.7_79 on my end. I have not been able to observe any issue while loading and saving the PNG file. I have used following sample code and for your convenience, I have shared the saved image as well.

public static void TestPNG()
{
  String path="C:\\Imaging Data\\Pics\\";

  com.aspose.imaging.fileformats.png.PngImage png = (com.aspose.imaging.fileformats.png.PngImage) com.aspose.imaging.Image
           .load(path + "tin.png");

  // Create an instance of PngOptions
  com.aspose.imaging.imageoptions.PngOptions options = new com.aspose.imaging.imageoptions.PngOptions();

  // Set the PNG filter method
  options.setFilterType(com.aspose.imaging.fileformats.png.PngFilterType.Paeth);

  // Save changes to the disc
  png.save(path + "tin_saved.png", options);   
}

tin_saved.jpg (188.2 KB)

I tested your code with Aspose.Imaging for Java 17.12 on MacOSX and Linux (Ubuntu 16.04 LTS). Both systems are unable to load the image. (java version “1.8.0_144” and java version “1.8.0_161”)

Here is the reported error:

Exception in thread "main" class com.aspose.imaging.coreexceptions.ImageLoadException: Image loading failed. ---> class com.aspose.imaging.internal.Exceptions.ArgumentNullException: Xml content not provided
Parameter name: xml
com.aspose.imaging.internal.hG.h.<init>(Unknown Source)
com.aspose.imaging.internal.hG.j.<init>(Unknown Source)
com.aspose.imaging.internal.loaders.PngLoader.load(Unknown Source)
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)
...
Caused by: class com.aspose.imaging.internal.Exceptions.ArgumentNullException: Xml content not provided
Parameter name: xml
com.aspose.imaging.internal.hG.h.<init>(Unknown Source)
com.aspose.imaging.internal.hG.j.<init>(Unknown Source)
com.aspose.imaging.internal.loaders.PngLoader.load(Unknown Source)
com.aspose.imaging.Image.a(Unknown Source)
com.aspose.imaging.Image.load(Unknown Source)

@thomas.winklehner,

I have observed your comments. Can you please share JDK version with us so that we may further investigate to help you out.

As mentioned:

@thomas.winklehner,

I have worked with the source file shared by you and have been able to observe the issue. An issue with ID IMAGINGJAVA-905 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be fixed. We will share good news with you soon.