How to resize an image without loading into memory?

I'd like to check the dimensions of an image, and then size it down if the width exceeds a given threshold. When I load a 6MB JPEG image with ImageIO.read(), the BufferedImage allocates about 45MB of heap space. Is there a way to do a passthrough image resize without loading all the data into memory? I tried passing ImageIO.read() a File object, thinking it would stream the data from disk, but it doesn't help.

5
задан Boris Burtin 17 May 2011 в 00:28
поделиться