ImageMagick is a free, open-source application installed as a binary distribution or as a 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, and many others.
In the following tutorial, you will learn how to install ImageMagick on Debian 11 Bullseye using the APT or Source installation method.
Table of Contents
- Recommended OS: Debian 11 Bullseye
- User account: A user account with sudo or root access.
- Required: git
Update Operating System
Update your Debian operating system to make sure all existing packages are up to date:
sudo apt update && sudo apt upgrade -y
The tutorial will be using the sudo command and assuming you have sudo status.
To verify sudo status on your account:
Example output showing sudo status:
[joshua@debian~]$ sudo whoami root
To set up an existing or new sudo account, visit our tutorial on Adding a User to Sudoers on Debian.
To use the root account, use the following command with the root password to log in.
Option 1 – Install ImageMagick from APT
The easiest and most recommended way to install 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.
First, install ImageMagick using the following command:
sudo apt install imagemagick
Option 2 – Install ImageMagick from Source
This installation choice isn’t recommended for the average user. However, for those wanting to use the source version, follow the steps below.
Firstly, make sure you have GIT installed:
apt install git -y
Now clone the GIT:
git clone https://github.com/ImageMagick/ImageMagick.git /usr/local/src/ImageMagick
Note, depending on how you set your GIT up, and you may need to use the sudo command.
Next, CD into the directory:
Now install the dependencies required:
apt install make build-essential automake
You will now need to use the ./configure command:
Advanced users want more from ImageMagick it is recommended to use –with-modules build:
Now that you have built and configured the environment, it is time to compile it with the command 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.
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
Now verify the installation and build:
Copyright: (C) 1999-2021 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(4.5) Delegates (built-in): fontconfig freetype jbig jng jpeg ltdl lzma png tiff x xml zlib
Updating ImageMagick from Source
If you installed ImageMagick from 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
Testing & Verify ImageMagick
The quickest way to test if ImageMagick is working is to use the convert logo command as follows:
convert logo: logo.gif
If you installed ImageMagick using either the default Debian repository or the ImageMagick source, the test logo.gif would be located in the home directory.
First CD to your home directory, replacing username with your own:
Then list the directory using the ls command:
If you installed from source, look in the source directory you installed ImageMagick in, then confirm if logo.gif has been created.
First, CD to the installation directory, for the tutorial it was:
Then, use the ls command to see if logo.gif is created:
Example Terminal Commands:
Below is a table of commands and tools 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 converting, 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.|
Commands and Conclusion
In the tutorial, you have learned two ways to install ImageMagick on Debian 11 Bullseye. Overall, 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.