Rubblewebs

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: 4

Despeckle image

Reduces the speckle noise in an image while preserving the edges of the original image

Despeckle image example
$im = new Imagick('addNoiseImage.jpg');
$im->despeckleImage();
$im->writeImage('despeckleImage.jpg'); 
$im->destroy();

( No noticable effect )

Destroy

Destroys the Imagick object and frees all resources associated with it.

Destroy example
$im = new Imagick($input);
$im->edgeImage( 0.5 );
$im->writeImage('destroy.jpg'); 
$im->destroy();

( Depreciated in favour of clear( ) )

Display image

This method displays an image on a X server.

Display images

Displays an image or image sequence on a X server.

Distort image

Distorts an image using various distortion methods.

See the distort section

Draw image

Renders the ImagickDraw object on the current image.

See the draw section

Edge image

Enhance edges within the image with a convolution filter of the given radius.

Edge image example
$im = new Imagick($input);
$im->edgeImage( 0.5 );
$im->writeImage('edgeImage.jpg'); 
$im->destroy();

( Use radius 0 and it will be auto-selected. )

Emboss image

Returns a grayscale image with a three-dimensional effect.

Emboss image example
$im = new Imagick($input);
$im->embossImage( 3, 0);
$im->writeImage('embossImage.jpg'); 
$im->destroy();

( We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and it will choose a suitable radius for you. )

Encipher image

Converts plain pixels to enciphered pixels.

Encipher image example
$im = new Imagick($input);
$im->encipherImage(passkey.txt);
$im->writeImage('encipherImage.png'); 
$im->destroy();

( The image is not readable until it has been deciphered using decipherImage(). You need to use a image format that is not compressed on saving e.g.png )

Enhance image

Applies a digital filter that improves the quality of a noisy image.

Enhance image example
$im = new Imagick($input);
$im->enhanceImage( );
$im->writeImage('enhanceImage.jpg'); 
$im->destroy();

Equalize image

Equalizes the image histogram.

Equalize image example
$im = new Imagick($input);
$im->equalizeImage( );
$im->writeImage('equalizeImage.jpg'); 
$im->destroy();

Evaluate image

Applys an arithmetic, relational, or logical expression to an image.

Evaluate image example
$im = new Imagick($input);
// Reduce the alpha by 50%
$im->evaluateImage(Imagick::EVALUATE_DIVIDE, 2, Imagick::CHANNEL_ALPHA);
$im->writeImage('evaluateImage.jpg'); 
$im->destroy();

( Use these operators to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image. )

Export image pixels

Exports image pixels into an array

Array (
[0] => 36
[1] => 45
etc.

$im = new Imagick($input);
$pixels = $im->exportImagePixels(10, 10, 2, 2, "RGB", Imagick::PIXEL_CHAR);
echo "<pre>";
print_r($pixels);
echo "</pre>";

( The map defines the ordering of the exported pixels. The size of the returned array is width * height * strlen(map). )

Extent image

Comfortability method for setting image size.

Extent image example
$im = new Imagick($input);
$im->setImageBackgroundColor( black );
$im->extentImage( 200, 200, 0, -25);
$im->writeImage('extentImage.jpg'); 
$im->destroy();

( The method sets the image size and allows setting x,y coordinates where the new area begins. )