In this tutorial, we will show you how to install ImageMagick on Ubuntu 22.04 LTS. For those of you who didn’t know, The ImageMagick is a very popular open-source software suite that is used to edit images such as adjusting image colors, resizing, mirroring, rotating, shearing the images, and drawing lines. ImageMagick is also available across all major platforms, including Android, BSD, Linux, Windows, macOS, iOS, etc.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the ImageMagick on Ubuntu 22.04 (Jammy Jellyfish). You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install ImageMagick on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade sudo apt install make build-essential automake libltdl-dev git
Step 2. Installing ImageMagick on Ubuntu 22.04.
- Install ImageMagick from the default APT repository Ubuntu.
By default, the ImageMagick is not available on Ubuntu 22.04 base repository. Now run the following command below to install the latest version of ImageMagick to your Ubuntu system:
sudo apt install imagemagick
- Install ImageMagick from the source file.
Now we clone the ImageMagick Git repository:
sudo git clone https://github.com/ImageMagick/ImageMagick.git /usr/local/src/ImageMagick cd /usr/local/src/ImageMagick
Next, compile using the command as follows:
sudo ./configure sudo ./configure --with-modules sudo make sudo make install
After the installation process of ImageMagick, the last step is to configure the dynamic linker run-time bindings:
sudo ldconfig /usr/local/lib
You can verify the installation of ImageMagick by typing the command below:
Step 3. Installing PHP Extension ImageMagick on Ubuntu.
Now we install
php-imagick with the following command below:
sudo apt install php-imagick
Verify the installation using the following command:
php -m | grep imagick
Don’t forget to reload Apache or Nginx web server after installing extensions:
sudo systemctl reload apache2 sudo systemctl reload nginx
Step 4. Test ImageMagick.
Once successfully installed, now we test if ImageMagick is working is to using the convert logo:
sudo convert logo: logo.gif
Step 5. ImageMagick Terminal Commands.
Table of commands that can be used with ImageMagick:
|animate||Display an image sequence as an animation.|
|compare||Analyze two images, and visualize mathematical differences between them.|
|composite||Compose one image over another with variable transparency to create a composite image.|
|conjure||Interpret and execute scripts written in MSL, the Magick Scripting Language.|
|convert||Convert images from one file format to another. This tool can also blur, crop, despeckle, dither, and otherwise modify the content of an image.|
|display||A simple image viewer.|
|identify||Display the image dimensions, quality, and other image metadata.|
|import||Capture the screen to an image file.|
|mogrify||Modify an image. Similar to convert, but overwrites the original image.|
|montage||Create an image composed of smaller images. This command can create a single image containing thumbnails of many images.|
|stream||Process 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.|
Congratulations! You have successfully installed ImageMagick. Thanks for using this tutorial for installing the ImageMagick on Ubuntu 22.04 LTS Jammy Jellyfish system. For additional help or useful information, we recommend you check the official ImageMagick website.