Introduction and installation of GraphicsMagick

Source: Internet
Author: User
Tags epel repo
Using OpenMP but using multiple threads for image processing enhances the processing capability by extending the CPU. GraphicsMagick can be used on most platforms. there are no problems with Linux, Mac, and Windows.

GraphicsMagick is known as the Swiss Army knife in the image processing field. The short and concise code provides a robust and efficient collection of tools and libraries to process Image reading, writing, and operations. it supports more than 88 image formats, includes important DPX, GIF, JPEG, JPEG-2000, PNG, PDF, PNM, and TIFF.

By using OpenMP but using multiple threads for image processing, you can improve the processing capability by extending the CPU.

GraphicsMagick can be used on most platforms. Linux, Mac, and Windows are all correct.

GraphicsMagick supports processing large images and has performed a GB-level image processing experiment. GraphicsMagick can dynamically generate images, especially for Internet applications. It can be used to adjust the size, rotate, highlight, color, and add special effects. GaphicsMagick not only supports the command line mode, but also supports calling C, C ++, Perl, PHP, Tcl, Ruby and so on. In fact, GraphicsMagick is from ImageMagick 5.5.2, but now it becomes more stable and excellent. Below are some comparisons between the two.

GM is more efficient (evaluation) and can complete processing more quickly

Smaller GM makes installation easier

GM has been used by Flickr and Etsy to process millions of images every day.

GM does not conflict with installed software

GM has almost no security issues

Extensive GM manuals

How to install:

Operating system: Centos 5.4 x86_64
Environment: LAMP
Programming Language: PHP

Prepare the installation environment

# Yum install-y gcc-c ++ make cmake autoconf automake
# Yum install-y libpng-devel libjpeg-devel libtiff-devel jasper-devel freetype-devel

Enable EPEL repo source

Self-search install epel-release-5-4.noarch.rpm

# Rpm-ivh epel-release-5-4.noarch.rpm

Warning: epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing... ######################################## ### [100%]
1: epel-release ##################################### ###### [100%]

Import key
# Rpm -- import/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

Install GraphicsMagick

# Yum-y install GraphicsMagick-devel

 

If you need to use pecl extension gmagick in php, the installation method is as follows:

# Yum instlal php-pear
# Pecl install gmagick
# Echo 'extension = gmagick. so'>/etc/php. d/gmagick. ini

If an error occurs while installing pecl extension

Case 1:

# Pecl install gmagick
Failed to download pecl/gmagick within preferred state "stable", latest release is version 1.1.2RC1, stability "beta", use "channel: // pecl.php.net/gmagick-1.1.2RC1" to install
Cannot initialize 'Channel: // pecl.php.net/gmagick', invalid or missing package file
Package "channel: // pecl.php.net/gmagick" is not valid
Install failed

Solution
# Pecl install channel: // pecl.php.net/gmagick-1.1.2RC1

Case 2:

# Pecl install gmagick

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 64 bytes) in/usr/share/pear/PEAR/XMLParser. php on line 142
Allowed memory size of 8388608 bytes exhausted (tried to allocate 72 bytes)

Solution:
# Vim + 142/usr/share/pear/PEAR/XMLParser. php
Add the following line:
Ini_set ("memory_limit", "100 M ");

Restart httpd
# Service httpd restart
 

Test page index. php

Phpinfo ();
?>


Access index. php and check whether the following content is successfully installed.

Test on php

Upload an image 1.jpg to/var/www/html (here is my default apache Directory)

# Cd/var/www/html

# Vi 1.php

 # If an extension error is reported, install libpng, libjpeg, and libmcrypt in the default directory.
$ Image = new Gmagick('1.jpg ');
$ Image-> borderImage ('blue', 3,3)-> oilPaintImage (0.1 );
$ Image-> write('2.jpg ');?>
Effect


Ps: Remember to grant the apache user write permission
Related Article

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: info-contact@alibabacloud.com 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.