ͼÏñÉú³ÉºÍ´¦Àí
ÔÚÏßÊֲ᣺ÖÐÎÄ Ó¢ÎÄ
PHPÊÖ²á

Image Processing (ImageMagick)


ͼÏñÉú³ÉºÍ´¦Àí
ÔÚÏßÊֲ᣺ÖÐÎÄ Ó¢ÎÄ
PHPÊÖ²á
PHPÊÖ²á - N: Image Processing (ImageMagick)

Óû§ÆÀÂÛ:

aem at teletype dot ru (30-Nov-2011 11:09)

To configure and build imagick extension with phpize, you must first install libmagickwand-dev and libmagickcore-dev.

For example, "sudo apt-get install libmagickwand-dev libmagickcore-dev" and then phpize and ./configure.

Mike Robinson (26-May-2009 02:11)

PHP Admins: I realize this could be considered a bug report, but please leave this up as it contains helpful information that can be used until this page is updated correctly.

-------------

Please note that this list is lacking many new methods that are available in the current stable release (and even some older ones). You can view the Imagick changelog by going to http://pecl.php.net/package-changelog.php?package=imagick

As of release version 2.3.0RC2 the following methods not listed here are also available for use:

Currently unstable releases (2.3.0+):

* Imagick::getImageMimeType

* Imagick::writeimagefile

* Imagick::writeimagesfile

* Imagick::resetimagepage

* Imagick::setimageclipmask

* Imagick::getimageclipmask

* Imagick::animateimages

* Imagick::recolorimage

* Imagick::floodfillpaintimage

* Imagick::opaquepaintimage

* Imagick::transparentpaintimage

* Imagick::decipherimage

* Imagick::encipherimage

* Imagick::getimagealphachannel

* Imagick::getimagechanneldistortions

* Imagick::getimagegravity

* Imagick::setimagegravity

* Imagick::remapimage

* Imagick::exportimagepixels

* Imagick::getimagechannelkurtosis

* Imagick::functionimage

* Imagick::importImagePixels

* Imagick::sparseColorImage

* Imagick::deskewImage

* Imagick::segmentImage

* Imagickdraw::gettextkerning

* Imagickdraw::settextkerning

* Imagickdraw::gettextinterwordspacing

* Imagickdraw::gettextinterwordspacing

* ImagickPixel::getColorValueQuantum

* ImagickPixel::setColorValueQuamtum

* ImagickPixel::getIndex

* ImagickPixel::setIndex

Latest stable (2.2.2):

* Imagick::getImageChannelRange

* Imagick::setImageAlphaChannel

* Imagick::mergeImageLayers()

* Imagick::setPointsize()

* Imagick::getPointsize()

Eero Niemi (eero at eero dot info) (08-Apr-2008 03:06)

To load image (usually vector image, like PDF) with larger resolution than image's default is, you have to set resolution before reading the file, like this:

<?php
$im
= new Imagick();
$im->setResolution( 300, 300 );
$im->readImage( "test.pdf" );
?>

mlong-php at mlong dot us (24-Oct-2007 09:11)

The fit functionality of thumbnailImage doesn't work as one would anticipate. Instead, use this to make a thumbnail that has max of 200x82:

  // Create thumbnail max of 200x82
  $width=$im->getImageWidth();
  if ($width > 200) { $im->thumbnailImage(200,null,0); }

  $height=$im->getImageHeight();
  if ($height > 82) { $im->thumbnailImage(null,82,0); }

mlong-php at mlong dot us (24-Oct-2007 07:46)

Here is an example on how to take an image that is already in a string (say, from a database), and resize it, add a border, and print it out. I use this for showing reseller logos

  // Decode image from base64
  $image=base64_decode($imagedata);

  // Create Imagick object
  $im = new Imagick();

  // Convert image into Imagick
  $im->readimageblob($image);

  // Create thumbnail max of 200x82
  $im->thumbnailImage(200,82,true);

  // Add a subtle border
  $color=new ImagickPixel();
  $color->setColor("rgb(220,220,220)");
  $im->borderImage($color,1,1);

  // Output the image
  $output = $im->getimageblob();
  $outputtype = $im->getFormat();

  header("Content-type: $outputtype");
  echo $output;

gmail dot com at james dot ellis (08-Oct-2007 12:41)

In case anyone is wondering about some examples for Imagick usage, take a look at Mikko Koppanen's blog at http://valokuva.org/?cat=1.