Use php_imagick to resize, rotate, sharpen, subtract, or add special effects to an image.

Source: Internet
Author: User
Tags imagemagick

Php_imagick isPHPAn extension package for image processing can be used to resize, rotate, sharpen, subtract, or add special effects to an image.


1. Install Imagick extension in windows:


1. Download and install ImageMagick

Http: // image_magick.veidrodis.com/image_magick/binaries/ImageMagick-6.6.2-10-Q16-windows-dll.exe


2. Download php_imagick.dll

Http://valokuva.org/outside-blog-content/imagick-windows-builds/php53/imagick-2.3.0-dev/vc9_nts/php_imagick.dll


If you are using thread-safe php, download

Http://valokuva.org/outside-blog-content/imagick-windows-builds/php53/imagick-2.3.0-dev/vc9_zts/php_imagick.dll


3. Set


Add in php. ini
Extension = php_imagick.dll, restart web server


Ii. Install Imagick extension in linux:


1. Install ImageMagick in yum

Yum install ImageMagick-devel


2. test whether the installation is successful.


Convert-version


3. Install imagick Extension


Wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
Tar xzvf imagick-3.1.0RC2.tgz
Cd imagick-3.1.0RC2
Phpize
./Configure
Make
Make install


4. Edit Php. iniFile, add the following code at the end of the file


Extension = imagick. so


5. Restart the apache server.


Service httpd restart


Iii. Cases


1. Border Processing


//by www.tsingyuan.cnheader('Content-type: image/jpeg');$image = new Imagick('test.jpg');$color=new ImagickPixel();$color->setColor("rgb(220,220,220)");$image->borderImage($color,5,4);$image->blurImage(5,5,imagick::CHANNEL_GREEN);echo $image;


2. Generate a thumbnail


//by www.tsingyuan.cnheader('Content-type: image/jpeg');$image = new Imagick('test.jpg');$image->thumbnailImage(50, 0);echo $image; 

This article describes how to use php_imagick to resize, rotate, sharpen, subtract, or add special effects to an image. I hope this article will inspire readers and help them solve their problems. Thank you for reading this article. Php technical questions are welcome to discuss: 304224365, verification: csl, O (∩ _ ∩) O thank you!

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.