How to Install ImageMagick on Ubuntu 22.04 LTS

ImageMagick is a free, open-source application installed as a binary distribution or source code. ImageMagick can convert, read, write and process raster images. ImageMagick is also available across all major platforms, including Android, BSD, Linux, Windows, Mac OSX, iOS, etc.

In the following tutorial, you will learn how to install ImageMagick on Ubuntu 22.04 Jammy Jellyfish using the APT or Source installation method.

Update Ubuntu

First, before anything, update your system to make sure all existing packages are up to date to avoid any conflicts.

sudo apt update && sudo apt upgrade -y

Install ImageMagick – APT Method

The easiest and most recommended way to install it is using the APT package manager for the average user. If this works correctly, stick with it and do not try and install the source method, as it will complicate things more than you need.

For the APT method, install ImageMagick using the following command.

sudo apt install imagemagick-y

And that is it; for alternative installation methods, check out the next section on how to compile ImageMagick.

Install ImageMagick – Compile Source Method

The second installation method is to clone ImageMagick GIT and compile the application. This installation choice is not recommended for the average user. However, for those wanting to use the source version to obtain the latest release or, for that matter, a particular older release, follow the steps below.

First, make sure you have GIT installed:

sudo apt install git -y

Now clone the ImageMagick GIT repository.

sudo git clone https://github.com/ImageMagick/ImageMagick.git /usr/local/src/ImageMagick

Note, depending on how you set your GIT/user privilege setup, you may need to use the sudo command.

Next, CD into the directory.

cd /usr/local/src/ImageMagick

Now install the dependencies required.

sudo apt install make build-essential automake libltdl-dev
  -y

Next, run the ./configure command as follows.

sudo ./configure

Advanced users want more from ImageMagick, and it is recommended to use –with-modules build.

sudo ./configure --with-modules

Now that you have built and configured the environment, it is time to compile it with the command make.

sudo make

A handy trick is to specify the -j <number of cpu> as this can significantly increase compiling speed if you have a powerful server.

For example, the LinuxCapable server has 6 CPUs, and I can use all 6 or at least use 4 to 5 to increase speed.

sudo make -j 6

After compiling the source code, now run the installation command in your terminal:

sudo make install

After the installation, you need to configure the dynamic linker run-time bindings:

sudo ldconfig /usr/local/lib

Directly verify the installation and build:

magick --version

Example output:

How to Install ImageMagick on Ubuntu 22.04 LTS

Update ImageMagick from Source

If you installed ImageMagick from the source using git, re-peat the installation process after you have pulled any new changes from the sources Github using the following terminal command:

sudo git pull

Test ImageMagick

The quickest way to test if ImageMagick is working is to use the convert logo command as follows:

sudo convert logo: logo.gif

Run the ls command in the directory you used the test in.

ls

Example:

How to Install ImageMagick on Ubuntu 22.04 LTS

ImageMagick Terminal Commands

Below is a table of commands and tools that can be used with ImageMagick.

Command Description
animateDisplay an image sequence as an animation.
compareAnalyze two images, and visualize mathematical differences between them.
compositeCompose one image over another with variable transparency to create a composite image.
conjureInterpret and execute scripts written in MSL, the Magick Scripting Language.
convertConvert images from one file format to another. This tool can also blur, crop, despeckle, dither, and otherwise modify the content of an image.
displayA simple image viewer.
identifyDisplay the image dimensions, quality, and other image metadata.
importCapture the screen to an image file.
mogrifyModify an image. Similar to convert, but overwrites the original image.
montageCreate an image composed of smaller images. This command can create a single image containing thumbnails of many images.
streamProcess image data and store it in a file as it is being streamed from an input source. Useful for situations with slow data streams or huge images whose data processing should begin before the entire image is stored.

Commands and Conclusion

In the tutorial, you have learned two methods to install ImageMagick on Ubuntu 22.04 LTS.

ImageMagick is still quite popular, especially around WordPress websites and plugins, and is a tried and tested option for displaying, creating, converting, modifying, and editing raster images.

For additional information, please visit the official ImageMagick website.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!