How to Install ImageMagick on Linux Mint 21 and 20

This guide demonstrates how to install ImageMagick on Linux Mint 21 and 20 through the command-line terminal. It covers two methods: utilizing the default Linux Mint/Ubuntu APT repository and downloading, compiling, and then installing the built ImageMagick binary for the latest version on your Linux Mint system.

ImageMagick, a versatile software suite for image manipulation, holds a significant place in the toolkit of Linux Mint users, especially those managing server environments. Its popularity stems from a rich set of features that cater to a wide array of tasks in image processing.

Here are some key features of ImageMagick:

  • Convert: Transform images between various formats.
  • Edit: Resize, flip, mirror, rotate, distort, shear, and transform images.
  • Draw: Add text, lines, polygons, and more to images.
  • Animate: Create dynamic image sequences.
  • Composite: Combine multiple images to create a single image.
  • Format Support: Extensive support for numerous image formats.
  • Color Management: Accurate color management with color profiles.
  • Command-line Processing: Ideal for automating tasks through scripting.

ImageMagick’s adaptability makes it a prime choice for personal use and commercial and industrial applications. Its command-line interface allows for efficient, scriptable operations, crucial in server environments where GUI-based applications may not be feasible. The following sections will delve into the installation process, providing a straightforward, technical walkthrough to get ImageMagick up and running on your Linux Mint system.

Install ImageMagick on Linux Mint via APT

Update Linux Mint System Before Installing ImageMagick

Begin the installation of ImageMagick on Linux Mint by updating your system. This step is crucial to ensure your system has the latest security updates and is compatible with ImageMagick.

Open your terminal and execute the following command:

sudo apt update && sudo apt upgrade

Install Required Libraries for ImageMagick

ImageMagick depends on various libraries for optimal functionality. Install these necessary libraries by running the command below in your terminal. This step prepares your system for ImageMagick installation by setting up its dependencies.

sudo apt install libpng-dev libjpeg-dev libtiff-dev
Terminal prompt for ImageMagick library installations on Linux Mint
Prompt for Installing ImageMagick Libraries

Install ImageMagick on Linux Mint via APT Command

Installing ImageMagick using the APT package manager is the simplest and most recommended approach for general users. This method avoids the complexities of manual compilation. To install ImageMagick using APT, input the following command in your terminal:

sudo apt install imagemagick

After this command, ImageMagick will be installed on your Linux Mint system.

Screenshot of ImageMagick installation using APT on Linux Mint
Installing ImageMagick via APT

For users that do not mind a few extra steps, the next section will demonstrate how to download, compile then install ImageMagick directly from the source for the latest version.

Install ImageMagick on Linux Mint via Source

Preparing for Installation: Checking GIT Presence

Begin by ensuring GIT is present on your Linux Mint system. GIT is essential for cloning the ImageMagick repository. Verify its installation with the command:

git --version

If GIT is not installed, remedy this by executing:

sudo apt install git

Cloning the ImageMagick Repository

Proceed to clone the ImageMagick repository. This step involves downloading the latest source code from the official ImageMagick GIT repository. Choose your desired directory and clone using:

git clone https://github.com/ImageMagick/ImageMagick.git

Alternatively, specify a directory, such as /usr/local/src/ImageMagick, for organized storage:

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

To change the ownership of the /usr/local/src/ImageMagick directory to the current user, you can use the following command:

sudo chown -R $USER:$USER /usr/local/src/ImageMagick

This command will change the ownership of the directory and all its contents to the user currently logged in, as represented by $USER.

Installing Dependencies for Compilation

ImageMagick’s compilation requires several dependencies. These dependencies are a mix of libraries and development tools that ensure a smooth build process. Install them by running:

sudo apt install build-essential libltdl-dev libjpeg-dev libpng-dev libtiff-dev libgif-dev libfreetype6-dev liblcms2-dev libxml2-dev

This step ensures that all the necessary tools and libraries are available for the next phase of the installation.

Installing essential packages for ImageMagick source installation on Linux Mint
Preparing for Source Installation of ImageMagick

Configure ImageMagick Build

Navigate to the ImageMagick directory you cloned earlier:

cd /path/to/ImageMagick

### Our Example ###

cd /usr/local/src/ImageMagick

Initiate the configuration of the ImageMagick source code. This process tailors the build to your specific system:

./configure

Advanced users seeking additional functionalities can enable optional features and modules by appending --with-modules to the configure command:

./configure --with-modules
Configuration completion for ImageMagick source installation on Linux Mint
Successful Configuration for ImageMagick Source Installation

Breakdown of Additional Functionalities with –with-modules

When you add --with-modules to the ./configure command, you enable a range of extended features in ImageMagick that are not included in the standard configuration. These additional functionalities often cater to more specialized image-processing tasks.

Here’s a breakdown of what you might expect:

  • Enhanced Format Support: ImageMagick with modules may support more image formats, especially less common ones, providing greater versatility in handling diverse types of image files.
  • Advanced Image Processing Features: This could include more sophisticated effects, filters, and transformations, allowing for more complex image manipulation tasks.
  • Increased Performance for Certain Tasks: Some modules may optimize specific operations, potentially leading to faster processing times for certain types of image manipulations.
  • Additional Tools and Utilities: The modules might include extra command-line tools or utilities that extend the functionality of ImageMagick beyond its core capabilities.
  • Custom Extensions: In some cases, --with-modules might allow for the integration of custom extensions or plugins developed by the ImageMagick community, offering tailored solutions for unique image processing needs.

Compile ImageMagick

Compile the source code using the make command:

make

This step converts the source code into executable binaries. The duration of this process depends on the system’s performance capabilities.

Successful completion of ImageMagick make command for source installation on Linux Mint
Completion of ImageMagick’s Make Command

This step converts the source code into executable binaries. The duration of this process depends on the system’s performance capabilities.

Installing the Compiled ImageMagick

After successful compilation, install ImageMagick onto your system with:

sudo make install

This command places the compiled binaries in the appropriate directories and makes ImageMagick available for use.

Configure Dynamic Linker for ImageMagick

Post-installation, it’s crucial to configure the dynamic linker run-time bindings. This configuration ensures that the system recognizes and correctly uses ImageMagick’s libraries:

sudo ldconfig /usr/local/lib

Omitting this step might lead to runtime errors when trying to use ImageMagick.

Verifying the Installation

Conclude the installation by confirming that ImageMagick is correctly installed:

magick --version

A successful installation will display the version number of ImageMagick.

ImageMagick latest version installed from source on Linux Mint
ImageMagick Installation via Source Completed

Utilizing ImageMagick on Linux Mint

Converting Image Formats with ImageMagick

ImageMagick facilitates format conversion between various image types. For instance, to convert a BMP image to a GIF, use the following command:

convert example.bmp example.gif

This command effectively changes example.bmp into a GIF file named example.gif.

Generating Thumbnails Using ImageMagick

Creating a thumbnail is a common task in image manipulation. ImageMagick streamlines this process. To create a 150×150 pixel thumbnail from a JPEG image, execute:

convert original.jpeg -thumbnail 150x150 thumbnail.jpeg

This command will produce a thumbnail named thumbnail.jpeg from original.jpeg.

Resizing Images with ImageMagick

ImageMagick excels in resizing images to specific dimensions. To resize an image to 300×300 pixels, the command is:

convert original.png -resize 300x300 resized.png

This adjusts original.png to a 300×300 pixel dimension, saving it as resized.png.

Embedding Text onto Images Using ImageMagick

Adding text to images is straightforward with ImageMagick. To overlay text onto an image, use:

convert original.png -font Helvetica -pointsize 24 -fill blue -draw "text 10,30 'Sample Text'" text_overlay.png

This command adds ‘Sample Text’ to original.png in blue Helvetica font, size 24, positioned at coordinates (10,30), and saves it as text_overlay.png.

More ImageMagick Command Examples

For further manipulation, ImageMagick offers a range of commands. For example:

  • Inverting Colors: To invert the colors of an image:
convert original.png -negate inverted.png
  • Rotating an Image: To rotate an image by 90 degrees:
convert original.png -rotate 90 rotated.png
  • Cropping an Image: To crop an image to a 100×100 pixel area starting at (50,50):
convert original.png -crop 100x100+50+50 cropped.png

Conclusion

That’s a wrap on our guide to ImageMagick on Linux Mint! We’ve covered everything from installing this powerful tool via APT or directly from the ImageMagick source to mastering a range of commands for converting, resizing, and even jazzing up your images with some text. Remember, while ImageMagick is pretty awesome for its versatility, the real magic happens when you start experimenting with it yourself. So go ahead, play around with those commands, and see what amazing things you can create.

1 thought on “How to Install ImageMagick on Linux Mint 21 and 20”

  1. I cant thank you enough. just to install a small app into linux mint I have lost couple hours until I have found your page. thanks for your time and help
    Best regards

    Reply

Leave a Comment