Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate PNG by ImageMagick

I want to rotate PNG file by convert command. like this.

convert -background 'rgba(0,0,0,0.5)' -rotate 45 1.png r1.png

But result PNG file is wrong like following. https://docs.google.com/spreadsheet/ccc?key=0AqzGWe_mT6dwdEIwa04xRldwVGtOX1VGbVJhRnZwX0E

The gray space is correct.

I don't know why black space exists.

What am I wrong?

thank you.


convert -version Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

like image 843
sekitaka Avatar asked Nov 20 '12 05:11

sekitaka


People also ask

How do I rotate an image in Linux?

The simplest way to do this is using convert function. Let us say you want to rotate file image. jpg by 90 degrees (counterclockwise). The above command will rotate image.

How do you rotate an image in Python?

The imutils. rotate() function is used to rotate an image by an angle in Python.


2 Answers

The image to modify comes straight after convert.

Try:

convert 1.png -background "rgba(0,0,0,0.5)" -rotate 45 r1.png
like image 82
Bonzo Avatar answered Oct 22 '22 07:10

Bonzo


This worked for me

$ convert 1.png -distort SRT -ANGLE_IN_DEGREES -gravity center r1.png
like image 27
Mohamed Elzarei Avatar answered Oct 22 '22 07:10

Mohamed Elzarei