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.

Advertisement

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 php7.1-imagick or php7.3-imagick etc.

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.

imagematick-on-ubuntu

Click here to read more details about ImageMagick setup and there uses.

Share.

20 Comments

  1. Thanks a lot for your post, and it helped me to install imagick on my unbutu.

    While I confused a little bit in step 3. It should be imagick PHP Extension but not ImageMagick PHP Extension.

  2. THANKS!

    I was trying to get jpeg / jpg file uploads working with mediawiki 1.23.6 on CentOS 7 with Apache/2.4.6 and php 5.4.16. I ran the command:

    yum install php-pear ImageMagick ImageMagick-devel ImageMagick-perl

    restarted httpd, and now everything works. Thanks!

    Sino

  3. sudo apt-get install libmagickwand-dev

    I found I had to install the above package to get the rmagick gem to install.

  4. Leandro dos Santos on

    # echo “extension=imagick.so” > /etc/php.d/imagick.ini
    -bash: /etc/php.d/imagick.ini: No such file or directory

    How to solve this?

    • It looks /etc/php.d directory doesn’t exists on your system. Add “extension=imagick.so” in your php.ini file.

  5. Thanks for the instructions.

    If you run into problems you may be that the /var/tmp directory is on a different drive to / and that you can’t build the files (our Rackspace servers running RHEL / CentOS are setup like this) – to get around this you can temporarily give /var/tmp executable permission e.g.

    mount -o remount,exec /var/tmp/
    (do stuff)
    then change the permissions back…
    mount -o remount,noexec /var/tmp/

Reply To Tim Cancel Reply

Exit mobile version