Sylwia Dorota Kedzia Sylwia is a Java developer. She is very passionate about programming and all things Polish.

How to Read JPEG2000 in Java

1 min read

In this article, I will talk you through on how to read JPEG2000 Image into a BufferedImage using ImageIO/JAI and our JDeli Image Library (a complete JPG converter). So let us start from the basics, what is JPEG2000?

What is JPEG2000?

JPEG2000 is an image decoding standard that was originally created as an update of the well known JPEG Format which was introduced in the year 2000 by the Joint Photographic Experts Group committee. It uses lossy compression image mode that is based on discrete wavelet transformation.

JPEG2000 compared to JPEG offers:

  1. A better higher compression performance,
  2. Outputs of multiple resolutions,
  3. The option for both lossless and lossy compression,
  4. Improved noise resilience,
  5. Flexibility in file formats,
  6. Bit depth support,
  7. advance support for transparency and alpha planes.

The filename extensions commonly associated with JPEG 2000 are: .jp2, .j2k, and .jpx.

Example Java code to read a JPEG2000 image in Java:

Here is some sample code using ImageIO/JAI and JDeli. (ImageIO needs JAI installed to support JPEG2000).

– Using JAI/ImageIO

Javadoc and Download for JAI (ImageIO is part of JDK)

//Read Image from File
File myJPegFile = new File("ImageAsJPeg.jp2");
BufferedImage image =;

– Using JDeli

Javadoc and Download

You can easily replace ImageIO (and get much better support for JPEG2000 files) by just changing to

//Read Image (can also be OutputStream or byte array)
File myJpegFileFile = new File("ImageAsJPeg.jp2"); 
BufferedImage image =;

Or you can use the JDeli JpegDecoder directly:

Jpeg2000Decoder decoder = new Jpeg2000Decoder();
BufferedImage decodedImage =;

Features Included in JDeli Jpeg2000 Decoder:

  • Colorspace : Bitlevel, Grayscale, RGB, CMYK and YCCK images
  • Bits Per Sample : 1 to 16
  • In additionally JDeli offers fastest Jpeg2000 Decoding capability in java

JDeli can read and write a very wide range of other image formats including writing JPEG2000. Here is the full list on Image file conversions supported.

You can find more tutorials in our series on handling common image formats in Java, JDeli and other image libraries.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Sylwia Dorota Kedzia Sylwia is a Java developer. She is very passionate about programming and all things Polish.

How to choose JPG versus JPEG2000 for image files

Since we started to support both JPG and JPG2000 as image file outputs in our software, we have found that this is a very...
Mark Stephens
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.