MagickCore RotateImage

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
nicolas1

MagickCore RotateImage

Post by nicolas1 »

Hi,

I have a problem, when I call MagickCore::RotateImage with for example -90 degrees, the return image size is not adjusted according to rotation (for example, swap width and height of result image). This results in distortion.... and the method seems to be useless with that feature. How could I call this method to get the image with correct dimensions?

ImageMagick-6.5.0-1

Thanks,
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: MagickCore RotateImage

Post by fmw42 »

try +distort SRT

see http://www.imagemagick.org/Usage/distorts/#srt

I don't know the API equivalents.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickCore RotateImage

Post by magick »

Are you using the call properly. Here's an example:
  • rotate_image = RotateImage(image, 90, exception);
    printf("%lu %lu => %lu %lu\n", image->columns, image->rows, rotate_image->columns, rotate_image->rows);
nicolas1

Re: MagickCore RotateImage

Post by nicolas1 »

yes, my fault.

RotateImage adjusts image result dimensions.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: MagickCore RotateImage

Post by anthony »

Their are ways of fixing the rotated image to bring it back to the original size.
See IM examples, Simple Image Warping, Rotating Images
http://www.imagemagick.org/Usage/warping/#rotate

However you may prefer to use the newer Distort Images, which uses a different technique and provides more control of the pixel level distortion that any form of rotation generates
Distorting Images, Scale-Rotate-Translate (SRT) Distortion
http://www.imagemagick.org/Usage/distorts/#srt
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply