How to Read JPEG2000 in Java

In this article I will talk you through on how to read JPEG2000 Image into a BufferedImage using ImageIO/JAI and our newJDeli Image Library. So lets 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

JavadocandDownloadfor JAI (ImageIO is part of JDK)

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

– Using JDeli

JavadocandDownload

Jpeg2000Decoder decoder = new Jpeg2000Decoder();
BufferedImage decodedImage = decoder.read(imageByteData);

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

We have also created a useful how to series on how to read and write various Image formats.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (Twitter, Facebook and Google+) or the Blog RSS.

Related Posts:

The following two tabs change content below.
Sylwia is a developer at IDR Solutions working on JavaFX Development and on the NetBeans JavaFX Plugin. She is very passionate about programming and aims to improve constantly.
Sylwia

About Sylwia Dorota Kedzia

Sylwia is a developer at IDR Solutions working on JavaFX Development and on the NetBeans JavaFX Plugin. She is very passionate about programming and aims to improve constantly.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>