read jpeg2000 files in java

两盒软妹~` 提交于 2019-11-28 12:14:04

You would do it in this way

Image img = ImageIO.read(new ByteArrayInputStream(imageBytes));
ImageIcon imgIcon = new ImageIcon(img);

JLabel label = new JLabel(imgIcon);

but the JPG2000 decoder isn't supplied with standard SDK, you should head here (Java Advanced Imaging) and use the right decoder for that format..

Apparently the support of jpeg2000 / ( .jp2 ) files has been removed from Java Advanced Imaging (JAI).

By un-installing JAI 1.1.3 and installing the older version 1.1, I'm now about to read .jp2 files and no longer see the null pointer.

Version 1.1 is available here. http://download.java.net/media/jai-imageio/builds/release/1.1/

Version 1.1 lists codec's for - g3fax g4fac jiio jp2k jpeg and png

The only options I know are all based on jj2000.

jai-imageio-core provides support through an additional third-party module:

https://github.com/stain/jai-imageio-core

https://github.com/jai-imageio/jai-imageio-jpeg2000

It'll register itself with ImageIO and you'll then be able to read jpeg2000 files as you would any png, bmp or jpeg.

Although jj2000 is in itself an option, the api is not designed for day-to-day use.

Other options include JMRTD, which provides its own wrapping for jj2000, or a commercial offering, JDeli.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!