Share on Social Media

Learn how to effortlessly install ImageMagick software on Rocky Linux 9 with our detailed step-by-step guide. Enhance your image processing capabilities and unlock creative potential today! #centlinux #linux #imagemagick #imagick

What is ImageMagick?

ImageMagick, ImageMagick is a powerful open-source software suite for displaying, converting, and editing raster image files. It can read and write over 200 image file formats, making it a versatile tool for working with images. ImageMagick is commonly used for tasks such as converting between different image formats, resizing and cropping images, applying various effects and filters, and generating thumbnails. It provides a command-line interface for batch processing as well as libraries for integration into programming languages like Python, PHP, and Perl. ImageMagick is widely used in web development, graphic design, and scientific applications due to its flexibility and extensive capabilities.

ImageMagick Features

ImageMagick offers a wide range of features for image processing and manipulation. Here are some key features:

  1. Image Conversion: ImageMagick supports conversion between over 200 image formats, including popular formats like JPEG, PNG, GIF, TIFF, and BMP.
  2. Image Editing: It provides tools for basic image editing tasks such as resizing, cropping, rotating, flipping, and adjusting colors.
  3. Image Effects: ImageMagick allows users to apply a variety of effects and filters to images, including blur, sharpen, emboss, edge detection, and more.
  4. Image Composition: Users can composite multiple images together, overlay text or graphics onto images, and create complex image compositions.
  5. Batch Processing: ImageMagick supports batch processing, allowing users to apply operations to multiple images simultaneously.
  6. Image Analysis: It provides tools for analyzing images, including extracting metadata, identifying colors, measuring image properties, and performing basic image recognition tasks.
  7. Command-Line Interface: ImageMagick can be used via a command-line interface, making it easy to integrate into scripts and automated workflows.
  8. Programming Interfaces: It offers APIs and libraries for integrating ImageMagick into programming languages like Python, PHP, Perl, Ruby, and more.
  9. High-Quality Rendering: ImageMagick uses high-quality rendering algorithms to ensure accurate and visually pleasing results.
  10. Cross-Platform Compatibility: ImageMagick is available for multiple platforms, including Linux, Windows, macOS, and various Unix systems.

Overall, ImageMagick is a versatile and powerful tool for image processing, editing, and manipulation, suitable for a wide range of applications including web development, graphic design, scientific analysis, and more.

What is Imagick?

Imagick is a PHP extension that provides a wrapper for the ImageMagick library, allowing PHP developers to access and manipulate images using ImageMagick’s functionality. It enables PHP scripts to perform a wide range of image processing tasks, such as resizing, cropping, rotating, applying filters and effects, and converting between different image formats.

With Imagick, PHP developers can harness the power of ImageMagick directly within their PHP applications, making it easier to work with images and perform complex image manipulations programmatically. This extension is commonly used in web development for tasks such as generating thumbnails, processing user-uploaded images, creating dynamic image content, and more.

Imagick provides an object-oriented interface in PHP, making it intuitive to use for developers familiar with object-oriented programming principles. Additionally, it offers extensive documentation and examples to help developers get started with integrating image processing capabilities into their PHP applications efficiently.

Environment Specification

We are using a minimal Rocky Linux 9 virtual machine with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux release 9.1 (Blue Onyx)
  • Hostname – web-01.centlinux.com
  • IP Address – 192.168.116.128/24

Update Rocky Linux Server:

Login as root user on your Linux server. You can use any ssh client for this purpose.

If you are not used to Linux commandline then we recommend that you should attend online training Linux Command Line: From novice to wizardshow?id=oLRJ54lcVEg&bids=1074652

Now, execute following command at Linux terminal to update your Rocky Linux server.

# dnf update -y

If above command updates your Linux Kernel, then you should reboot your Linux server, before moving forward with this Linux tutorial.

# reboot

Note down the versions of Linux operating system and Linux Kernel.

# cat /etc/rocky-release
Rocky Linux release 9.1 (Blue Onyx)

# uname -r
5.14.0-162.23.1.el9_1.x86_64

Install ImageMagick Prerequisites:

Here, we are installing ImageMagick with PHP-Imagick to use by a web application for conversion of images.

Now, there is a question arises in the mind of many readers that:

Is it mandatory to setup a LAMP server for ImageMagick?

The answer is certainly NOT.

You can easily install ImageMagick separately on a Linux server. But it is being observed that, the ImageMagick is most commonly used by web applications. Therefore, we are installing a PHP based web server here.

Execute following dnf command to install Apache and PHP on Rocky Linux 9.

# dnf install -y httpd php-fpm

Enable and start Apache and PHP services.

# systemctl enable --now httpd php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.

Allow the HTTP service in Linux Firewall to make your websites accessible from network.

# firewall-cmd --permanent --add-service=http
success
# firewall-cmd --reload
success

Install Third Party Yum Repositories:

ImageMagick software is available in EPEL (Extra Packages for Enterprise Linux) yum repository. Therefore, install EPEL repository by using dnf command.

# dnf install -y epel-release

Additionally, you may enable the CRB (CodeReady Builder) yum repository.

Be informed that, Power Tools repository has been replaced by CRB repository in Rocky Linux 9.

Enable the CRB repository executing following Linux command.

# /usr/bin/crb enable
Enabling CRB repo
CRB repo is enabled and named: crb

Build yum cache for newly installed yum repositories.

# dnf makecache

Install ImageMagick Software on Linux

All repositories has been setup. Now you can easily install ImageMagick on Linux by invoking dnf command.

# dnf install -y ImageMagick ImageMagick-devel

Check the version of Magick-config to verify ImageMagick installation.

# Magick-config --version
6.9.12-82 Q16

Install Imagick (PHP Extension)

PHP Imagick is a PHP extension to create and modify images using the ImageMagick API.

You need to install PHP development and PHP Pear to install and manage PHP extensions.

# dnf install -y php-devel php-pear make

Now, you can install PHP Imagick by executing pecl command.

# pecl install imagick

Add Imagick extension to php.ini file.

# echo "extension=imagick.so" > /etc/php.d/20-imagick.ini

Restart Apache and PHP services to load Imagick module.

# systemctl restart httpd php-fpm

Execute following command to verify that Imagick module is loaded successfully.

# php -m | grep imagick
imagick

You can also verify this by creating a phpinfo webpage.

# echo "<?php phpinfo ();?>" > /var/www/html/index.php

Open URL http://web-01.centlinux.com in a web browser.

PHPInfo Page 1
PHPInfo Page 1

Scroll down and you will find the Imagick section there.

PHPInfo Page 2
PHPInfo Page 2

Video to install ImageMagick on Rocky Linux 9

YouTube player

Final Thoughts

When it comes to installing ImageMagick software on Rocky Linux 9, the possibilities for enhancing your image processing capabilities are endless. Whether you’re a developer, designer, or enthusiast, ImageMagick opens up a world of creative potential and practical utility. By following our comprehensive guide, you’ll seamlessly integrate this powerful tool into your workflow, unlocking new avenues for image manipulation, conversion, and analysis. Embrace the power of ImageMagick on Rocky Linux 9, and elevate your projects to new heights with ease and efficiency. We suggest that you should read The Definitive Guide to ImageMagick (PAID LINK) by Michael Still, before using ImageMagick for image conversions.

Leave a Reply

Your email address will not be published. Required fields are marked *