To convert an image between different formats on a Linux system from the command prompt, you can use the convert
utility, which is part of the ImageMagick
suite of tools. ImageMagick
is a powerful, open-source image processing tool that can be used to create, edit, and convert images between various formats.
To install ImageMagick
, you will need to use your system's package manager. On a Debian-based system, such as Ubuntu, you can use the following command:
sudo apt-get install imagemagick
On a Red Hat-based system, such as CentOS, you can use the following command:
sudo yum install imagemagick
Once ImageMagick
is installed, you can use the convert
command to convert an image between different formats. For example, to convert an image input.jpg
to the PNG format and save the result to output.png
, you can use the following command:
convert input.jpg output.png
You can specify the desired output format using the -format
option:
convert input.jpg -format png output.png
You can also use the -resize
option to resize the image while converting it:
convert input.jpg -resize 500x500