TIFF and LibTiff Mail List Archive


1994.02.09 10:54 "Rotating huge images?", by Thies Arntzen
1994.02.09 01:11 "Re: Rotating huge images?", by Richard Minner

1994.02.09 01:11 "Re: Rotating huge images?", by Richard Minner

i want to rotate (in 90 degree steps) huge images (> 20MB). and i don't want to use 2 buffers of 20MB to do that! so does anyone know of a package that can rotate pictures on a disk without having twice as mutch memory as the image is in size?

First, get your terms right: huge images are >100MB. 20MB is just "large" :-)

Now, I'm not sure I follow, but you do not need two _memory_ buffers to rotate an image. If the image itself will fit into ram, you just load it up as a big raster, then grab lines from the ram image as you need them to write the rotated result. Now, if you want the ram image to be rotated wrt the disk image, you just do it backwards, reading scanlines from the disk image and writing them into the ram image in the right place.

For 90 degree rotations you'll be cutting "across the grain" but that doesn't matter if the whole thing fits (easily) into ram. Beware however that if your image spills out of ram into virtual memory (swap space), cutting across the grain for a 90 degree rotation means disk-thrashing death. You can end up faulting on each pixel read! Not good. For images larger than physical ram, you really have no alternative but to use tiling (in ram), to avoid thrashing. This is not trivial, but quite doable.

Hope that helps, and best of luck.

Richard Minner {uunet,sun,well}!island!rtm
Island Graphics Corporation Sacramento, CA (916) 736-1323