我无法获得 ImageReaderByFormatName(“jpeg-lossless”)

发布于 2024-11-01 04:58:58 字数 1164 浏览 1 评论 0原文

我正在尝试使用 JAI_ImageIO 库和以下 java 调用解码无损 jpeg:

ImageIO.getImageReadersByFormatName("jpeg-lossless").hasNext()

结果为“null”。

注意:我已将 JAI_ImageIO jar 安装到 jre/lib/ext 目录中。

我不知道 JPEG 阅读器是否足以读取无损 jpeg,或者是否需要安装另一个阅读器。

当我枚举 FormatNames 时,即:

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 阅读器时,我得到以下运行时异常:

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。

I am trying to decode a lossless jpeg using JAI_ImageIO library and the following java call:

ImageIO.getImageReadersByFormatName("jpeg-lossless").hasNext()

results in "null".

NOTE: I have the JAI_ImageIO jar installed to my jre/lib/ext directory.

I don't know if the JPEG reader is sufficient to read lossless jpegs or if another reader is required to be installed.

When I enumerate the FormatNames, i.e.:

ImageIO.getReaderFormatNames()

I get the following formats:

[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]

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)

When I try to

ImageIO.read(file)

directly I get a an org.dcm4cheri.image.ConfigurationException.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔一刀 2024-11-08 04:58:58

好的,我找到了我的特定问题的答案,我相信它将解决如何至少在基于 *NIX 的操作系统上正确安装 JAI_ImageIO 的更普遍的问题。

阅读以下内容后(WWW 上的不起眼的地方)并尝试描述的 JAI_ImageIO 的所有 3 个安装替代方案 此处。 (我还应该提到我正在 Debian 6.0 64 位平台上运行。)

在解决了 manual "安装类型" 我意识到我的 LD_LIBRARY_PATH 变量没有被选取。所以我决定强制解决这个问题,并在我的/usr/lib中添加一个到libclib_jiio.so的软链接。你瞧,它成功了。

我使用了提供的代码 此处 确定我的 JAI_ImageIO 是否安装正确,安装正确后,您应该在输出中看到“JPEG-LOSSLESS”格式/提供程序!

感谢您的建议。我将尝试扩展问题,使其更普遍地解决安装 JAI_ImageIO pro 的问题

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.

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.)

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.

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!

Thanks for the suggestions. I will try to expand the question to make it more general to the problem of installing JAI_ImageIO pro

む无字情书 2024-11-08 04:58:58

我不认为 jpeg-lossless 是 JAI 的有效格式。尝试列出您可用的格式:

String[] formats =  ImageIO.getReaderFormatNames();
for ( String format : formats ) {
    System.out.println(format);
}

我认为您真正想要的是“JPEG2000”。

您是否也刚刚尝试过 ImageIO.read(file)?如果您安装了 JAI,那么应该可以成功读取 DICOM 文件。

I do not think jpeg-lossless is a valid format for JAI. Try listing your available formats:

String[] formats =  ImageIO.getReaderFormatNames();
for ( String format : formats ) {
    System.out.println(format);
}

I think what you actually want is "JPEG2000".

Have you also just tried ImageIO.read(file). That should successfully read DICOM files if you have JAI installed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文