2

是否有允许随机访问其部分的文件格式(图像文件)。例如,我有一个分辨率为 100000x100000 像素的巨大图像文件,我只想读取一小部分。就像具有缩放级别的地理地图。

我想用Java编写一些应用程序。我可以使用数百个小文件并以某种方式组合它们,但如果有一种方法可以使用一个大文件(或其中几个)来完成它会更好。

4

3 回答 3

0

但如果有办法用一个巨大的文件来做到这一点会更好

我不这么认为。正如 Manuel 所说,访问压缩图像的随机位置很复杂,因为大多数压缩算法都考虑整个图像以最大化压缩能力。因此,解压过程将使用大量内存来解压这种大小的图像。

另一方面,文件在没有压缩的情况下会大几个数量级。

我认为您应该使用与 Google Maps 或Zoompy等工具相同的方法。获取原始的巨大图像并将其分解为图块。通过这种方式,可以压缩图块,并且可以使用更少的内存执行可视化。

于 2014-07-16T17:35:09.133 回答
0

Your ability to do that will depend on the file format you are using for the pictures. In principle, non-compressed file formats as BMP or TIFF will give you more freedom at reading specific regions.

The good news is that you have a standard Java class (see ImageReader) that allows you to do exactly what you are looking for by specifying a region of interest (read section 3.3.1 ImageReadParam).

However as I stated before, it will depend on your image format. At the ImageReader class itself you have a handy method named 'isRandomAccessEasy' that will return true if the storage format of the given image places no inherent impediment on random access to pixels (verbatim from official docs).

于 2014-07-14T21:32:28.397 回答
0

纹理压缩

查看纹理压缩格式,它们被设计为既可压缩又允许随机访问,以减少 GPU 纹理上用于 3D 渲染的图像带宽https://en.wikipedia.org/wiki/Texture_compression

与传统的图像压缩算法不同,纹理压缩算法针对随机访问进行了优化。

以下格式似乎是开放的:

ARM Mali AFBC 是一个(专有?)示例https://www.arm.com/products/graphics-and-multimedia/mali-technologies

随机访问到 4x4 块级别

于 2016-11-17T09:21:18.167 回答