ImageMagick is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats like GIF, JPEG, PNG, Postscript, and TIFF. We can also use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
This article will help you to install ImageMagick on 19.04, 18.04 & 16.04 LTS operating systems.
Step 1 – Prerequsities
First of all, You need to install the required packages in order to install ImageMagick and Imagick PHP extension. You can also visit our tutorial to install different versions of PHP on Ubuntu.
sudo apt install php php-common gcc
Step 2 – Install ImageMagick
After installing required packages, let’s install ImageMagick using the following command. ImageMagick package is available under default apt repositories.
sudo apt install imagemagick
Step 3 – Install imagick PHP Extension
At this point, you have successfully installed ImageMagick package on your system. Now, you need to install Imagick PHP extension, So that we can use it through PHP code.
sudo apt install php-imagick
For different PHP version’s you need to install the specific version of imagick like
Step 4 – Restart Apache and Verify
After completing above steps you need to reload apache service to enable php exension using following command
sudo systemctl restart apache2
Now verify that module is enabled properly.
php -m | grep imagick imagick
You can also create
phpinfo() file to view ImageMagick on the web browser.
Click here to read more details about ImageMagick setup and there uses.