Re: Large image re-scaling
From: Dave Martindale (davem_at_cs.ubc.ca)
Date: 06/05/04
- Next message: BiTEC Ltd: "Re: Image processing systems"
- Previous message: flipdog: "image video formats"
- In reply to: Michael Cooper: "Large image re-scaling"
- Next in thread: Scott: "Re: Large image re-scaling"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 5 Jun 2004 17:01:35 +0000 (UTC)
crwper@mustagh.com (Michael Cooper) writes:
>I have a fairly large image (21600x21600x3) which I would like to
>enlarge to 32768x32768. I've tried several packages (GIMP,
>ImageMagick, Paint Shop Pro, Image Genius, PhotoZoom Pro, etc.), but
>they all seem to be trying to load the entire file into memory first.
>I'm not terribly fussy about the interpolation technique, although I'd
>like something better than the nearest-neighbour code I've just
>written. Bicubic would be fine. The image is currently in TIFF format.
It doesn't have to be done this way. Upsampling, like many image
processing operations, is a localized computation. Every output pixel
depends on a limited-size region of the input. For bicubic resampling,
the input size is 4x4, while larger filters use 8x8 input pixels or even
more. But whatever the number, it's a tiny fraction of the total image.
If there is no rotation involved, the simplest method for limited-memory
resampling is to read as many scanlines of the original as the extent
of the filter kernel into a buffer. Then you generate one output
scanline. Every several output scanlines (depending on the
magnification factor), you dump the oldest input scanline which is no
longer needed, and read in one new scanline. I've written an image
resampler that works this way.
If even that involves too much memory, or if rotation is involved, it's
probably best to divide the input image into square tiles, and then
manage a tile input buffer rather than scanline buffer. For reasonable
tile and kernel sizes, you'll probably find you need only 4 input tiles
and one output tile in memory at any time.
As for commercial software that does this, Photoshop operates on image
tiles if the image won't fit in the amount of main memory you give it.
But, as the other followup said, why do you want to resize this image in
the first place? There's almost certainly a better way to do whatever
you're trying to accomplish without creating all that redundant data.
Dave
- Next message: BiTEC Ltd: "Re: Image processing systems"
- Previous message: flipdog: "image video formats"
- In reply to: Michael Cooper: "Large image re-scaling"
- Next in thread: Scott: "Re: Large image re-scaling"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|