Convert: An ImageMagick tool to modify images

The convert program is a member of the ImageMagick suite of tools. Use it to convert between image formats as well as resize an image, blur, crop, despeckle, dither, draw on, flip, join, re-sample, and much more.

Getting the convert tool

The ImageMagick suite should be inside your extra packages. It might not be installed by default depending on your distribution. If it is not the case, simply install it with the following command.

On a Debian base distributions, do the following.

apt-get install imagemagick

On ArchLinux based distributions, do the following.

pacman -S imagemagick

How to use

Convert an image file to an other format

The following formats are supported: .jpg, .bmp, .pcx, .gif, .png, .tiff, .xpm, and .xwd

convert car.jpg car.png
convert cake.gif cake.bmp
convert icon.tiff icon.pcx

Resize an image

To resize to a specific pixel width and height, use the -resize flag.

convert -resize 800x600 wolf.jpg wolf-small.jpg

To resize to a specific percentage, use the -sample flag.

convert -sample 50%x50% beach.png beach-small.png

Rotate an image

You can rotate an images from 0 to 360 degrees. You can also use negative degree values. To rotate, use the -rotate flag.

These two will create the same image since 270 and -90 degree are the same.

convert -rotate 270 RWBY.png RWBY_270.png
convert -rotate -90 RWBY.png RWBY_-90.png

This example rotates the image by 29 degrees (to the right).

convert -rotate 29 boat.jpg boat_29.jpg

Flip and image horizontally and vertically

Use -flip to flip an image horizontally.

convert -flip house.jpg house-vertical.jpg

Use -flop to flip an image vertically.

convert -flop spaceship.bmp spaceship-horizontal.bmp

Combine the flags

Bonus: you can append those flags inside the same command. You could change the file type as you are using the -resize and -flip flags.


  1. Negus, Christopher, and Fran├žois Caen.Ubuntu Linux toolbox: 1000+ commands for Ubuntu and Debian power user. John Wiley & Sons, 2008.