我无法获得ImageReaderByFormatName(“jpeg-lossless”) [英] I can't get an ImageReaderByFormatName("jpeg-lossless")
问题描述
我正在尝试使用JAI_ImageIO库和以下java调用解码无损jpeg:
I am trying to decode a lossless jpeg using JAI_ImageIO library and the following java call:
ImageIO.getImageReadersByFormatName("jpeg-lossless").hasNext()
结果为null。
注意:我的jre / lib / ext目录中安装了JAI_ImageIO jar。
NOTE: I have the JAI_ImageIO jar installed to my jre/lib/ext directory.
我不知道JPEG阅读器是否是足以读取无损jpeg或者是否需要安装其他阅读器。
I don't know if the JPEG reader is sufficient to read lossless jpegs or if another reader is required to be installed.
当我枚举FormatNames时,即:
When I enumerate the FormatNames, i.e.:
ImageIO.getReaderFormatNames()
我得到以下信息格式:
[raw, jpeg, tif, WBMP, PNM, JPG, DICOM, wbmp, JPEG, PNG, jpeg 2000,
tiff, BMP, JPEG2000, RAW, jpeg2000, GIF, TIF, TIFF, jpg, bmp, pnm,
png, JPEG 2000, gif]
当我尝试使用JPEG2000阅读器时,我得到以下运行时异常:
I get the following runtime exception when I try to use the JPEG2000 reader:
java.lang.RuntimeException: File is neither valid JP2 file nor valid JPEG 2000 codestream
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.initializeRead(J2KReadState.java:696)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.<init>(J2KReadState.java:209)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.read(J2KImageReader.java:449)
at javax.imageio.ImageReader.read(ImageReader.java:940)
当我尝试
ImageIO.read(file)
直接我得到一个org.dcm4cheri.image.ConfigurationException。
directly I get a an org.dcm4cheri.image.ConfigurationException.
推荐答案
好的,我找到了我的特定问题的答案,我相信它将解决如何至少在基于* NIX的操作系统上正确安装JAI_ImageIO的更普遍的问题。
OK, I found the answer to my particular problem and I believe it will solve the more general problem of how to install JAI_ImageIO properly at least on *NIX based operating system.
阅读以下内容后( WWW上的模糊位置)并尝试JAI_ImageIO的所有3种安装选择描述了此处。 (我还应该提到我在Debian 6.0 64位平台上运行。)
After reading the following (Obscure place on the WWW) and attempting all 3 installation alternatives of JAI_ImageIO described here. (I should've also made mention that I am running on a Debian 6.0 64bit platform.)
使用 manual 安装类型我意识到我的LD_LIBRARY_PATH变量没有被选中向上。所以我决定强制解决这个问题,并在我的/ usr / lib中添加一个到libclib_jiio.so的软链接。瞧,它看起来有效。
After settling with the manual "installation type" I realized that my LD_LIBRARY_PATH variable wasn't being picked up. So I decided to force the issue and add a soft link to the libclib_jiio.so in my /usr/lib. Lo and behold it worked.
我使用了提供的代码此处确定我的JAI_ImageIO是否安装正确,以及如果安装正确,你应该在输出中看到JPEG-LOSSLESS格式/提供商!
I used the code provided here to determine if my JAI_ImageIO was installed properly, and when it is installed properly you should see a "JPEG-LOSSLESS" formats/providers in the output!
感谢您的建议。我将尝试扩展问题,使其更加通用于安装JAI_ImageIO pro的问题
Thanks for the suggestions. I will try to expand the question to make it more general to the problem of installing JAI_ImageIO pro
这篇关于我无法获得ImageReaderByFormatName(“jpeg-lossless”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!