如何使用Java磁贴读取TIFF文件? [英] How to read a TIFF file by tiles with Java?
问题描述
假设我有一个非常大的TIFF图像作为输入.由于必须遵守的内存规格,我无法完全加载该映像.因此,以下不是一种选择:
Let's say I have a very large TIFF image as input. I am not able to load this image entirely because of memory specification I must comply with. So the following is not an option :
BufferedImage data = ImageIO.read(image);
有没有Java库允许读取图像的特定部分而不缓冲整个图像?还是从流中获取TIFF切片的某些方法?
Is there any Java library allowing to read a specific part of the image without buffering the whole image ? Or some ways to get TIFF tiles from a stream ?
推荐答案
ImageIO可以为您提供Tiff的ImageReader,然后您可以使用
ImageIO can provide you an ImageReader for Tiff, and then you can use readTile.
ImageIO has several getImageReadersBy...
methods.
我不知道ImageIO是否支持tiff,但是ImageIO使用Java SPI,因此可以插入ImageReaders和ImageWriters.
I am not aware whether tiff is supported by ImageIO, but ImageIO uses java SPI so one may plug-in ImageReaders and ImageWriters.
实际上,这是read
的快捷方式,其中ImageReadParam
配置为图块.
In fact this is a short-cut for read
with ImageReadParam
configured for tiles.
从不使用图块,但看到先前的答案,我想指出此选项.
这篇关于如何使用Java磁贴读取TIFF文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!