开发者

very large image manipulation and tiling

I need a software or program in Java or a method for tiling very large images (bigger than 140MB). I have used ImageMagick and convert tools Photoshop and Corel Draw and Matlab (in Windows), but I have a problem with memory overload. ImageMagick is very slow and result is not des开发者_如何转开发irable. I don't know how can I only load a small part of image to memory without loading the whole image from harddisk.


If you use native code, libraries such as libjeg give you scanline access to to images - you'd at most need to load 16 scanlines at a time.


You should take a look at the Java Advanced Imaging (JAI) API, which provides out-of-the-box support for tiling large images. It's a somewhat complicated API and documentation is a tad sparse, but we've used it in a project for viewing very tall (but narrow) images that are around 60 mb a piece.

Here are a few links to get you started:

Process images in Java with JAI

JAI project homepage


It is not Java, but Inter Performance Primitives (IPP) have set of functions for image manipulation that work on tiles. You can probably interface these functions from Java.


JAI is platform dependent and seems like a dead project today.

I advise using the open-source program imagemagick. Although it is platform dependent, it is available for the same platforms as JAI, but with full community support.

The trick about large images about imagemagick is using its "stream"-command instead of the convert command. Stream only reads the relevant portion of the image and saves the extracted part as raw data. You then need "convert" to save the small raw data as jpeg.

Example to save a tile from large.jpeg of size 800x600 from position 0x0 to tile.jpeg:

    stream -extract 800x600+0+0 large.jpeg tile.rgb

    convert -depth 8 -size 800x600 rgb:tile.rgb tile.jpeg

(When running on windows, be sure to use ImageMagick's convert.exe, as there is a windows command named "convert".)

When working with TIFF-images only, apache Sanselan could be the right choice - it is a pure-java imaging lib. Also, JAI seems to contain a platform independent codec for TIFF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜