Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rotate an image without changing its size?

When an image is rotated by convert -rotate command the image size is enlarged. Is there a way to rotate around the center and to keep the image size, cropping the edges?

like image 566
lizarisk Avatar asked Feb 07 '13 12:02

lizarisk


People also ask

Does size change in rotation?

A rotation is a type of transformation which is a turn. A figure can be turned clockwise or counterclockwise on the coordinate plane. In both transformations the size and shape of the figure stays exactly the same.

How do I rotate an image in Photoshop without distorting it?

There are a few different ways that you can rotate an image in Photoshop without rotating the canvas. One way is to go to Image > Image Rotation > 180. This will rotate the image clockwise by 180 degrees. Another way is to go to Edit > Transform > Rotate 90 CW.


2 Answers

convert image.jpg -distort SRT -45 rotate_cropped_image.png

See http://www.imagemagick.org/Usage/warping/#animations

Example: Animated GIF

See also help on -distort: http://www.imagemagick.org/script/command-line-options.php?#distort

like image 90
Enyby Avatar answered Oct 11 '22 12:10

Enyby


This seems now to simply "just work" -- for counter-clockwise 90 degrees:

$ convert image.jpg -rotate -90 rotated_ccw.jpg
like image 34
scrat.squirrel Avatar answered Oct 11 '22 10:10

scrat.squirrel