无法使用Java ImageIO标准库读取和写入TIFF图像文件 [英] Can't read and write a TIFF image file using Java ImageIO standard library
问题描述
我不知道如何处理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屋!