无法使用 Java ImageIO 标准库读写 TIFF 图像文件 [英] Can't read and write a TIFF image file using Java ImageIO standard library

查看:41
本文介绍了无法使用 Java ImageIO 标准库读写 TIFF 图像文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何处理 TIFF 图像,但我无法使用直接的 Java 标准 ImageIO 库读取或写入其中的任何图像.有什么想法吗?

I don't know what to do with TIFF images, but I can't read or write any of them using straight Java standard ImageIO library. Any thoughts?

谢谢.

推荐答案

如果您因任何原因不喜欢或不能使用 JAI,我为 ImageIO 编写了一个 TIFF ImageReader 插件,可在 GitHub.它是纯 Java 的,不需要任何本地安装,并带有非常友好的开源许可证 (BSD).

If you don't like or can't use JAI for any reason I have written a TIFF ImageReader plugin for ImageIO, available on GitHub. It is pure Java and does not need any native installs, and comes with a very friendly open source license (BSD).

它支持任何基线 TIFF 选项,以及许多标准扩展.从 3.1 版开始,TIFF 插件也有写入支持.

It supports any baseline TIFF option, along with a lot of standard extensions. From version 3.1 the TIFF plugin also has write support.

在您的类路径中使用正确的 JAR 文件后,用法可以很简单:

With the proper JARs in your class path, usage can be as simple as:

BufferedImage image = ImageIO.read(inputTIFF);
// ...modify image (compose, resize, sharpen, etc)...
ImageIO.write(image, "TIFF", outputTIFF);

这篇关于无法使用 Java ImageIO 标准库读写 TIFF 图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆