Editing image format files on Linux
●Rotate the image
The Linux convert command can be used to rotate images.
To rotate an image, add the "-rotate" option to the convert command and specify the rotation angle as an argument.
[root@Lion ~]# convert -rotate 90 sample.jpg sample_90.jpg ↑Rotate the file "sample.jpg" 90 degrees clockwise and save it as a file "sample_90.jpg". ※The rotation angle is essentially clockwise. To rotate counter-clockwise, specify a negative value |
●Enlarge or reduce the image
To scale an image file, use the convert command with the "-geometry" option. You can specify the width and height as arguments, but if you want to scale the image while keeping the aspect ratio, you can specify the ratio as "%".
[root@Lion ~]# convert -geometry 640x480 sample.jpg sample_640x480.jpg ↑Change "sample.jpg" to 640 pixels wide and 480 pixels high, and save it as "sample_640x480.jpg". Change the destination file extension to that of another image while enlarging or reducing the image. [root@Lion ~]# convert -geometry "60%" sample.jpg sample_640x480.BMP ↑Reduce "sample.jpg" to 60% width and save as BMP format "sample_60.BMP |