Install ImageMagick or its php module on Ubuntu 20.04 LTS Server

The commands given here to install ImageMagick or PHP Imagick are applicable for both Ubuntu 18.0 LTS Bionic and Ubuntu 204.04 LTS Focal Fossa.

ImageMagick is a free, open-source software package for creating and editing raster graphics. It can currently read, modify and write more than 200 of the most popular image formats. In addition, images can be generated dynamically, which is why it is also used by web applications. it is also available as a PHP module to integrate the functionally of ImageMagick for PHP-based applications or CMS such as WordPress.

Well, if you are looking for an ImageMagick alternative the there is a program graphicsmagick, a spin-off of it, and can also be installed on Ubuntu via the default package manager.

Steps to install ImageMagick or Php-Imagick on Ubuntu 20.04 LTS Server

Run system update

First, run a system update command on your Ubuntu 20.04 or 18.04 server or desktop to refresh the system packages and repo cache.

sudo apt update

 

Install ImageMagick or Php-Imagick on Ubuntu 20.04/18.04

Both ImageMagick main packages or its PHP module can be installed using the default system repository of Ubuntu, which means we don’t need to add any third-party repository at all.

For ImageMagick, the command will be:

sudo apt install imagemagick imagemagick-doc

Whereas those who just wanted the PHP extension, can go for:

sudo apt install php-imagick

This will select the default latest PHP version available on Ubuntu and install the available Imagick module. However, if you are looking for some specific version such as for php8.0 then you have to first add its repo and then mentioned the version in the above command.

Example:

Add PHP 8.0 repo

sudo add-apt-repository ppa:ondrej/php

Run system update

sudo apt update

And then install ImageMagick PHP extension for the 8.0 version

sudo apt install php8.0-imagick

 

Check Imagemagick Version

To check which version of this graphic program has been installed on your system, run:

convert -version

Check version of Imagemagick

 


Few Commands

Well, if you want to use this graphic program natively on your system, then ImageMagick offers 11 command-line programs, all of which access a common set of libraries, which in turn enable the writing and reading of many different files formats and extensive graphic work.

animate – plays several pictures in quick succession

convert – reads images, processes them, and saves them

compare – compares 2 images and outputs the differences as an image file

composite – superimposes several images to form one image

conjure – Runs scripts in ImageMagick’s scripting language

display – displays images on an X server

identify – outputs the file format, image size, etc. of image files

import – takes screenshots

montage – combines several images into one large single image

mogrify– like Convert, only that the input file is replaced by the output file!

stream – Reads out parts of image files and outputs them as raw data, floating-point numbers, or the like

There is a man page for each command-line program. The separate documentation can be found at/usr/share/doc/imagemagick-doc/index.html

Install PHP ImageMagick on Ubuntu 20.04 LTS Server

 

Other articles:

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.