ImageMagick is an free open source simple software suite for any kind of image manipulation that is used for creating, editing, converting, displaying image files. It can able to read and write over 200 image files such as JPEG, GIF, PNG, TIFF and Photo CDimage formats and it is also used for thumbnail or captcha generation. It also includes command line options for creating transparent or animated gif image formats and many more feature like resize, sharpen, rotate or add special effects to an image.
To use ImageMagick tool with PHP or Perl programming language, you will need to installImageMagick with Imagick PHP extension for PHP and ImageMagick-perl extension for Perl.
Imagick is an simple php extension for creating and modifying images using theImageMagick API program. There is a confusion in name, as people think thatImageMagick and Imagick both are same, but you can use ImageMagick without Imagickextension but you need both installed on your machine to use and run it.
Installing ImageMagick
First, install following prerequisite php-pear and gcc packages to compile imagick PHP extension.
Once you’ve installed php-pear and gcc packages, you may now install ImageMagicksoftware for PHP and Perl support using Yum command.
Next, compile the imagick for PHP extension. To do, simple run the following ‘pecl‘ command. It will install ImageMagick and imagick PHP extension module ‘imagick.so‘ under /usr/lib/php/modules directory. If you are using 64-bit system, the module directory path would be /usr/lib64/php/modules.
Note: It will ask you to provide Imagemagick installation prefix, simply hit enter to auto detect.
Now, add the ‘imagick.so‘ extension to ‘/etc/php.ini‘ file.
Next, restart Apache web server.
启动相应的服务器
Verify imagick PHP extension by running the following command. You will see imagick extension similar to below.
Alternatively, you can create a file called ‘phpinfo.php‘ under website root directory (ex:/var/www/html/).
Add the following code.
Open your favorite web browser and type ‘http://localhost/phpinfo.php‘ or ‘http://ip-addresss/phpinfo.php‘ and verify the imagick extension.