Link
Skip to main content

Java PNG Reader

The JDeli Java image library includes a PNG Reader to read PNG images into Java. The PNG Decoder is written in 100% Java and provides PNG support with no dependencies.

What is supported

The JDeli PNG reader supports the following features:

Feature Support
Compression - NONE yes
Compression - 8bit Quantised yes
Compression - Zlib yes
Alpha yes
RGB yes
Palette yes
Grayscale yes
Filtering yes
ICC yes
Metadata EXIF
Takes file input Yes
Takes InputStream input Yes
Takes byte[] input Yes
Pure Java implementation Yes

Quick start:

Add JDeli to your project via Maven or Gradle, or see using JDeli with Java modules.

JDeli can automatically detect the file type and will use the PNG File Reader

BufferedImage image = JDeli.read(pngImageFile);

or

PngDecoder decoder = new PngDecoder();
BufferedImage image = decoder.read(pngData);

See the full Javadoc.

Performance comparisons:

These figures were generated using jmh (as documented on our blog) with a standard set of images (also documented). They should be easy to replicate if you wish to validate, the code is on GitHub.

The higher the number, the better.

Mode: Throughput Count: 25 Units: ops/s

Benchmark Score Error
Apache 1151.556 ± 12.405
ImageIO 296.915 ± 12.564
JDeli 2160.496 ± 43.874
ICafe 184.446 ± 0.917

Tested on 2021 14inch M1 MacBook Pro using JDK 18.0.1.1


Frequently asked questions

Does JDeli produce better PNG reading and decoding than Java ImageIO?

Yes. While ImageIO can read PNG, JDeli provides better compatibility, more consistent output across platforms, and access to format-specific decoding options.

Does reading or decoding PNG in Java with JDeli require additional libraries?

No. JDeli is a 100% Java library with no dependencies. It runs on any platform where the JVM runs with no additional installation.

What input types does JDeli support for reading PNG?

JDeli can read and decode PNG from a File, InputStream, or byte array.

See also


Why JDeli?

  • Support image formats such as AVIF, HEIC and JPEG XL that are not supported in Java.
  • Process images up to 3x faster than ImageIO and alternative Java image libraries.
  • Prevent JVM crashes caused by native code in other image libraries such as ImageIO.
  • Handle JPEG, PNG, TIFF image file formats fully in Java.
  • Keep your Image files secure as JDeli makes no calls to any external system or third party library.

Learn more about JDeli

Start Your Free Trial