在Java中存储大图像-教程 [英] Storing a large image in java - tutorial

查看:94
本文介绍了在Java中存储大图像-教程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在磁盘上保存大图像-太大会导致内存不足错误(例如10000x10000 px).假设是平铺,并且我将平铺作为BufferedImage存储在内存中.我读了一些关于TiledImage类的信息,该类仅能处理部分图像,其余部分存储在磁盘上,但是我还没有找到一个简单的示例来做到这一点? 能否请我指向或创建一个傻瓜教程,说明如何在磁盘上存储大映像而不将其全部存储在内存中?就像在磁盘上直接创建大映像一样:",访问"它的一部分,并像这样存储数据:或者它可以工作..

I need to save a large image on disk - so large it creates outofmemory errors (like 10000x10000 px). It's suppose to be a tiling and I have the tile stored in memory as a BufferedImage. I read something about TiledImage class being able to work only with part of image, the rest being stored on disk, but I haven't found a simple example of how to do this? Could you please point me to or create a tutorial for dummies on how to store a large image on disk without having it all in memory? Like "create large image straight on disk like this:", "access its part and store data in it like this:" or however it works..

我知道这里已经被问过几次了,但是我通读了所有这些内容,并且在Google上搜索了很多,但仍然没有找到一个完整的(可理解的)示例.也许是语言障碍,或者我只是对这种东西很愚蠢,无论如何,请帮忙:)

I know this has been asked here a couple of times, but I read through all of that and googled a lot but still haven't found a whole working (or comprehendable) example. Maybe it's the language barrier, or I'm just stupid in this kinda stuff, anyway, help, please :)

推荐答案

您是否已签出 DiskMemImage ,来自他们的文档:

Have you checked out DiskMemImage, from their documentation:

该类的作用与JAI的标准TiledImage类相同:即可写图像,可以容纳各种数据类型,可选的ColorModel和以图块形式排列的数据.但是,与TiledImage不同, DiskMemImage使用磁盘以及内存存储 ,以允许在有限的内存中处理非常大的图像.

This class serves the same purpose as JAI's standard TiledImage class: namely, a writable image that can accommodate a variety of data types, an optional ColorModel, and data arranged in tiles. However, unlike TiledImage, DiskMemImage uses disk as well as memory storage to allow very large images to be handled in limited memory.

这篇关于在Java中存储大图像-教程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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