I'm looking for a Java library that can output PNG files. In my image-creation routine, I know the image size and the color of each pixel.

I want my image-creation routine to be usable in two ways:

  • as a stand-alone executable JAR file
  • as a JAR library to be included in an Android project

If I needed only one of these requirements, the solution would be easy: For the stand-alone scripts, it's possible to use BufferedImage, Graphics2D and ImageIO API-s that are included in Java SE; while Android has APIs included under android.graphics.* for image creation.

However, I'd like to use the same code for both use cases. This means I need to depend on a single library that can create an image, fill it with pixels, and output as a PNG file.

So far I found only JDeli which appears to be commercial.

One library is https://github.com/leonbloy/pngj/wiki.

This is a very good library, and SO has word limits.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.