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

Raise image

Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image.

Raise image example
$im = new Imagick($input); 
$im->raiseImage( 10, 10, 200, 150, False );
$im->writeImage( "raiseImage.jpg" );
$im->destroy();

( Members width and height of raise_info define the width of the vertical and horizontal edge of the effect. )

Random threshold image

Changes the value of individual pixels based on the intensity of each pixel compared to threshold.

Random threshold image example
$im = new Imagick($input); 
$im->randomThresholdImage( 500, 5000 );
$im->writeImage( "randomThresholdImage.jpg" );
$im->destroy();

( The result is a high-contrast, two color image. )

Read image

Reads image from filename.

Read image blob

Reads image from a binary string.

Read image file

Reads image from open filehandle

Recolor image

Translate, scale, shear, or rotate image colors.

/*
$matrix = array( '1 0 0 0, 0, 0.5', '0 1 0 0, 0, 0', '0 0 1 0, 0, 0', '0 0 0 1, 0, 0', '0 0 0 0, 1, 0', '0 0 0 0, 0, 1');
$im = new Imagick($input);
$im->recolorImage( $matrix );
$im->writeImage('recolorImage.jpg'); 
$im->destroy();
*/

( This method supports variable sized matrices but normally 5x5 matrix is used for RGBA and 6x6 is used for CMYK. The last row should contain the normalized values. Not working as expected - getting errors )

Reduce noise image

Smooths the contours of an image while still preserving edge information.

Reduce noise image example
$im = new Imagick($input);
$im->reduceNoiseImage( 5 );
$im->writeImage('reduceNoiseImage.jpg'); 
$im->destroy();

( The algorithm works by replacing each pixel with its neighbor closest in value. A neighbor is defined by radius. Use a radius of 0 and reduceNoiseImage() selects a suitable radius for you. )

Remap image

Replaces colors an image with those defined by replacement.

Remap image example
$im = new Imagick($input);
$replacement = new Imagick('gradient.png');
$im->remapImage( $replacement, imagick::DITHERMETHOD_UNDEFINED );
$im->writeImage( "remapImage.jpg" );
$im->destroy();

( The colors are replaced with the closest possible color. )

Remove image

Removes an image from the image list.

Remove image profile

Removes the named image profile and returns it.

Render

Renders all preceding drawing commands.

Resample image

Resample image to desired resolution.

Reset image page

The page definition as a string.


( The string is in format WxH+x+y )

Resize image

Scales an image to the desired dimensions with a filter.

Resize image example
$im = new Imagick($input);
$im->resizeImage( 100, 100, imagick::FILTER_LANCZOS, TRUE );
$im->writeImage('resizeImage.jpg'); 
$im->destroy();

( The filter is optional as Imagick will pick the best filter to use when increasing or decreasing size. )