Rotate An Image With ImageMagick
Code
# white (or possibly black) background
magick mogrify -rotate 45 a.png
# transparent background
magick mogrify -background 'rgba(0,0,0,0)' -rotate 45 a.png
# black background
magick mogrify -background 'rgb(0,0,0)' -rotate 45 a.png
-
Rotates the image 45 degrees clockwise
-
Rotates the image in place (i.e. it updates the file)
-
Expands the canvas to cover the points which extend out on the rotate
-
Puts a white background on area that is expanded