PNG libraries for Java
- ImageIO (
javax.imageio) is part of the JDK and reads and writes PNG with one line of code. Its metadata API exposes all chunks, but is verbose. - PNGJ reads and writes PNG row by row, so it handles huge images with little memory, and gives direct access to every chunk.
On Android use android.graphics.BitmapFactory and Bitmap.compress(Bitmap.CompressFormat.PNG, ...); ImageIO is not available there.
- ImageIO Java ImageIO (javax.imageio) reads and writes PNG files with no extra dependencies. How to load and save PNG, get the size without decoding, set compression.
- PNGJ PNGJ is a pure Java library that reads and writes PNG files row by row. How to process huge PNG images with little memory, create a PNG, copy chunks.