THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.
I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.
IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.
Imagick Functions page: 15
Ping image
This method can be used to query image width, height, size, and format without reading the whole image in to memory.
Output below$image = $input; $im = new Imagick(); $im->pingImage( $image ); $info = $im->identifyImage(); echo "<pre>"; print_r($info); echo "</pre>";
( Array
(
[imageName] => /home/usr/public_html/imagemagick/imagick/temp.jpg
[format] => JPEG (Joint Photographic Experts Group JFIF format)
[geometry] => Array
(
[width] => 200
[height] => 150
)
[resolution] => Array
(
[x] => 72
[y] => 72
)
[units] => PixelsPerInch
[type] => Bilevel
[colorSpace] => RGB
[compression] => JPEG
[fileSize] => 16.2kb
)
)
Ping image blob
This method can be used to query image width, height, size, and format without reading the whole image to memory.
width = 200 height = 150$image = file_get_contents($input); $im = new Imagick(); $im->pingImageBlob($image); echo 'width = '.$im->getImageWidth() . ' height = ' . $im->getImageHeight();
Ping image file
This method can be used to query image width, height, size, and format without reading the whole image to memory.
Polaroid image
Simulates a Polaroid picture.

$im = new Imagick($input); $im->polaroidImage(new ImagickDraw(), 15); $im->writeImage('polaroidImage.png'); $im->destroy();
Posterize image
Reduces the image to a limited number of color level.

$im = new Imagick($input); $im->posterizeImage( 256, 10); $im->writeImage('posterizeImage.jpg'); $im->destroy();
Preview images
Tiles 9 thumbnails of the specified image with an image processing operation applied at varying strengths.
Not working$im = new Imagick($input); $im->previewImages( imagick::PREVIEW_ROTATE ); $im->destroy();
( This is helpful to quickly pin-point an appropriate parameter for an image processing operation. )
Previous image
Assocates the previous image in an image list with the Imagick object.
Profile image
Adds or removes a ICC, IPTC, or generic profile from an image.
( If the profile is NULL, it is removed from the image otherwise added. Use a name of '*' and a profile of NULL to remove all profiles from the image. )
Quantize image
Analyzes the colors within a reference image
Quantize images
Analyzes the colors within a sequence of images
Query font metrics
Returns a multi-dimensional array representing the font metrics.
$im = new Imagick(); $draw = new ImagickDraw(); $draw->setFont('Times-Bold'); $metrics = $im->queryFontMetrics($draw, "Rubblewebs"); echo "<pre>"; print_r($metrics); echo "</pre>";
( Array
(
[characterWidth] => 12
[characterHeight] => 12
[ascender] => 9
[descender] => -3
[textWidth] => 63.90625
[textHeight] => 18
[maxHorizontalAdvance] => 13
[boundingBox] => Array
(
[x1] => 0.09375
[y1] => 0
[x2] => 8.484375
[y2] => 9
)
[originX] => 64
[originY] => 0
)
)
Query fonts
Returns the configured fonts.
$im = new Imagick(); $fonts = $im->queryFonts(); echo "
Fonts available:"; foreach( $fonts as $key=>$value ){ echo "
$value"; }
( Fonts available:
AvantGarde-Book
AvantGarde-BookOblique
AvantGarde-Demi
etc. )
Query formats
Returns formats supported by Imagick.
$im = new Imagick(); $formats = $im->queryFormats(); echo "
Formats supported:"; foreach( $formats as $key=>$value ){ echo "
$value"; }
( Supported formats :
A
AI
ART
ARW
AVI
etc.
)
Radial blur image
Radial blurs an image.

$im = new Imagick($input); $im->radialBlurImage( 10 ); $im->writeImage( "radialBlurImage.jpg" ); $im->destroy();