How to convert images using the Linux terminal

Hello, friends. In this post, you will learn how to convert images using the Linux terminal. This post, which can help us in scripts and many external programs.

Install ImageMagick

The ImageMagick tool is a library with which you can create, edit, compose, or convert digital images. It supports many available formats and is presented for Linux without a lot of fuss.

ImageMagick can resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses, and Bézier curves.

One of the best things about this tool is that it is open source and free, and it has excellent support for Linux.

Installation is easy. On Debian, Ubuntu and derivatives just run:

sudo apt install imagemagick potrace

For Arch Linux and its derivatives like Manjaro

sudo pacman -S imagemagick hostscript libheif libjxl libraw librsvg libwebp libwmf libxml2 libzip ocl-icd openexr openjpeg2 djvulibre pango potrace

This is how to install the tool as well as essential components to manipulate it.

How to convert Images using the Linux Terminal

Basically, the structure of how to use the command to convert images is as follows:


To find out which formats you can convert, you have to use the following command

convert -list format

Just like that.

Now, let’s suppose you want to convert an image from PNG to JPEG format

convert file.png image.jpg

The command also works with absolute and relative paths. In this case, it assumes the existence of a file.png file in the current directory at the prompt. And the output will be image.jpg. Similarly, in the output, you can specify a full path and another file name.

The procedure is the same for each of the supported formats.

You can also convert a GIF to a video file like MP4 and vice versa.


Converting images using the terminal is simple and is only limited to one command. However, it can be useful for many things.

I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook