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.

1 Answer 1


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

  • License: unknown
  • JAR size: 170kB
  • Does not use java.awt.* or javax.imageio.*, making it usable on both Android and desktop/server.
  • Available on the Maven Central repository.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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