Imagick is a popular PHP extension. Use imagick for creating, converting, resizing, and editing images using the ImageMagick library. It can read and write images in more than 200 variety of file formats like GIF, JPEG, PNG, etc.

Imagick Supported File Formats

Imagick is widely used in web applications because it uses multiple computational threads to increase performance.

Installing imagick is pretty easy which can be done in just a couple of minutes. This tutorial will show you step by step guide on how to install Imagick on Ubuntu 16.04 or 18.04 or 19.04.

Prerequisites:

Before installing Imagick PHP extension, let us assume that we already have the following things up and running .

  • Ubuntu 16.04 or 18.04 or 19.04 LTS
  • Server Running Linux, Apache, MySQL, PHP (LAMP) Stack.

1. Install PHP Imagick

Install imagick PHP extension by running the following command:

sudo apt install php-imagick

To install imagick PHP extension for different versions of PHP you must include version of PHP to the command like php7.1-imagick

2. Restart Apache

After installing imagick you need to restart apache service to enable newly added PHP extension. To do so run the following command:

sudo systemctl restart apache2

3. Verify Installation of Imagick

You can verify if imagick has been installed and enabled with the following command:

php -m | grep imagick

If the installation was successful, the output of the command will show module name which is something like below

imagick

To view imagick in web browser create a PHP file with <?php phpinfo(); ?>

imagick phpinfo

Advantages:

To see performance improvements you can do the following below.