Page 1 of 1

Rotating an image seems slow

Posted: 2009-06-11T11:02:00-07:00
by pitosalas
I writing a specialized deskew algorithm for USA voting ballots. I've figured out the angle that I need to rotate based on various marks that are always present.

What's the fastest way to do a rotate?

The basic API call 'rotate' appears to be very slow.

It takes 13 seconds on a Mac G5 to rotate a TIFF 1696x2824 1696x2824+0+0 DirectClass 8-bit 585kb

Is that normal? Is there a better way?

Thanks!

Pito

Re: Rotating an image seems slow

Posted: 2009-06-11T11:11:01-07:00
by magick
The speed of ImageMagick is relative to the hardware its running on. Add -debug cache to your command line to see if the pixels are cached to disk or memory. If its disk, it can be slow (disk is always slower than real memory). If you have a dual-core system, ImageMagick can split the work between cores if your ImageMagick release is modern. We just converted a 4096x4096 image 13 degrees in less than 5 seconds on our 16GB 4 processor system.

Re: Rotating an image seems slow

Posted: 2009-06-11T18:29:08-07:00
by anthony
The alternative way to rotate is to use -filter point +distort SRT {angle} +repage

Using -distort instead of the 'plus' version will be slightly faster, but may clip some detail from the image corners, if this is a skewed scan however that loss is probably junk in any case.

If this is faster than normal -rotate for your large image then... let us know...
Then look at IM Examples, distorting Images to understand the operation and what else you can do with it.
http://www.imagemagick.org/Usage/distorts/

You may also like to look at the info in IM Examples, Simple Image Warping, Rotate
http://www.imagemagick.org/Usage/warping/#rotate