Rotated image gets unsharp/less quality

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

Rotated image gets unsharp/less quality

Post by pictogram »

Hello,

when i rotate an image using the "-rotate 7" command, the resulting image looks unsharp and somewhat "flat" (less colors). Do i do something wrong? Re-sharpening it with "-sharpen 1" corrects this a bit.
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Rotated image gets unsharp/less quality

Post by whugemann »

I think that this lies in the nature of rotation: The color values of the rotated image have to be interpolated from the neighbouring pixels in the original image, and any interpolation will blur the image by some extent. The effect will be most visible in images with sharp contrasting edges, like sketch drawings or cartoon-type images.

You could however try to choose an interpolation method more suitable for your actual image content via -interpolate.
Wolfgang Hugemann
pictogram
Posts: 17
Joined: 2010-03-23T14:19:21-07:00
Authentication code: 8675308

Re: Rotated image gets unsharp/less quality

Post by pictogram »

I see. The image i rotate is resized to about 30%. Does the order of scale/rotate matter? In my case i see no optical difference.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Rotated image gets unsharp/less quality

Post by anthony »

7 degrees is about the worst rotation angle you can get ;-)

rotate uses a fast technique (3 shears) that is fairly fuzzy. Distort produces rotations at higher quality, with much more control over that quality but at a speed cost. make sure you IM is at least version 6.6.5-0 or better still the latest you can get!

See Im examples, Simple Image Warping, Rotating a Thin Line
http://www.imagemagick.org/Usage/warping/#rotate_line

Interpolated Rotations (thin line)
http://www.imagemagick.org/Usage/misc/#interpolate_line

Distort SRT (Scale Rotate Translate)
http://www.imagemagick.org/Usage/distorts/#srt

Distort General Theory, concepts and problems with image distortions (including rotations and scaling)
http://www.imagemagick.org/Usage/distorts/#summary

Distort Super Sampling (which works VERY well for rotations)
http://www.imagemagick.org/Usage/distorts/#super_sample
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply