PHP ImageMagick Library Installation use

Source: Internet
Author: User
Tags imagemagick

ImageMagick Introduction:

Imagemagick®is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PNG, POSTSC Ript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various s Pecial effects, or draw text, lines, polygons, ellipses and Bézier curves.

The Functionality of ImageMagick is typically utilized from the command line or yo U can use the features from programs written in your favorite language. Choose from these interfaces: g2f  (Ada), magickcore  (c), magickwand  (c),  chmagick  (Ch), imagemagickobject  (COM +), magick++  (c + +),jmagick  (Java),  l-magick  (Lisp), lua, nmagick  (neko/haxe),  (. NET),  PascalMagick   (Pascal), perlmagick  (Perl),  magickwand for PHP (PHP), imagick  (PHP),  pythonmagick  (Python), rmagick  (Ruby), or tclmagick  (TCL/TK). With a language interface, use ImageMagick to modify or create images dynamically and  automagically .

ImageMagick is free software delivered as a ready-to-run binary distribution or as source code this you could use, copy, mod Ify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license, approved by the OSI and recommended for use by the OSSCC.

The ImageMagick development process ensures a stable API and ABI. Before ImageMagick release, we perform a comprehensive security assessment that includes memory error and thread data Race detection to prevent security vulnerabilities.

The current release was ImageMagick 6.9.0-3 available from Http:// It runs on Linux, Windows, Mac os X, IOS, Android Os, and others.

The authoritative ImageMagick Web site is

The famous image service provider Flickr uses ImageMagick, and Yupoo, the home of the mobile phone is also imagemagick.


Windows installation:

Download Windows edition:

After installation, the PHP extension is installed: The official recommended 3:

Magickwand for PHP A native php-extension to the ImageMagick magickwand API.

Imagick is a native PHP extension to create and modify images using the ImageMagick API. Documentation for the extension are available here.

Phmagick is a wrapper class for ImageMagick, wrapping the most common web image manipulation actions on easy to use FUNCTI ONS, but allowing full access to ImageMagick's power by issuing system calls to it's command-line programs.

decided to use Imagick.

DLL extensions under Windows in Imagick

Rename to Php_imagick.dll and copy to PHP's ext folder
Adding settings to the php.ini file
After viewing phpinfo () There is no Imagick column, if you have some words can be tested.


Linux Installation:

Download Source code:

Refer to the official tutorials:

$ CD ImageMagick-6.9.0

$ ./configure

$ Make

Make install

Execution:/usr/local/imagemagick/bin/convert logo:logo.gif test to see if ImageMagick works.

Or: Convert-version

2. Install PHP Extension: Imagick

The latest package can be found in the address below Http://

Tar zxvf imagick-3.0.1.tgz
Export Pkg_config_path=/usr/local/imagemagick/lib/pkgconfig
Make && make install

Make && make install
Cd.. /

Edit/usr/local/php/etc/php.ini add: Extension = ""

Edit/usr/local/php_fcgi/etc/php.ini add: Extension = ""

Restart PHP-FPM or Apache.


Try it first, then execute: ldconfig, reload some of the link libraries.

(I use the Pecl install Imagick installation, after installation prompts:

You should add "" to PHP.ini

Increase on the line. )

Php_imagick Program Examples

1. Create a thumbnail image and display it
Header (' Content-type:image/jpeg ');
$image = new Imagick (' image.jpg ');
If 0 is provided as a width or height parameter,//aspect ratio is maintained
$image->thumbnailimage (100, 0);
Echo $image;

2. Create a thumbnail in a directory and save
$images = new Imagick (Glob (' images
$im = new Imagick ("Example.gif");

foreach ($im as $frame) {

$frame->thumbnailimage (50, 50);

$frame->setimagepage (50, 50, 0, 0);
$im->writeimages ("Example_small.gif", true);




PHP ImageMagick Library Installation use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.