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

Get resource

Returns the specified resource's memory usage in megabytes.

Get resource limit

Returns the specified resource limit in megabytes.

Get sampling factors

Gets the horizontal and vertical sampling factor.

Get size

Returns the size associated with the Imagick object


( As an array with the keys "columns" and "rows". )

Get size offset

Returns the size offset associated with the Imagick object.

Get version

Returns the ImageMagick API version as a string and as a number.

API version number: 1608
API version string: ImageMagick 6.4.8 2010-10-13 Q16 OpenMP http://www.imagemagick.org

$version = Imagick::getVersion();
echo "API version number: ".$version['versionNumber']."
"; echo "API version string: ".$version['versionString']."
";

Hald clutImage

Replaces colors in the image using a Hald lookup table.


( Hald images can be created using HALD color coder. )

Has next image

Checks if the object has more images

Has previous image

Checks if the object has a previous image

Identify image

Identifies an image and returns the attributes.

See notes.

$im = new imagick( $image );
$identify = $im->identifyImage();
echo '<pre>';
print_r($identify);
echo '</pre>';

( Array
(
[imageName] => /DSCF0848.jpg
[format] => JPEG (Joint Photographic Experts Group JFIF format)
[units] => PixelsPerInch
[type] => TrueColor
[colorSpace] => sRGB
[compression] => JPEG
[fileSize] => 102KB
[mimetype] => image/jpeg
[geometry] => Array
(
[width] => 600
[height] => 451
)

[resolution] => Array
(
[x] => 72
[y] => 72
)

[signature] => 2000cbb4dfc0cd90ec35528dad6f0df109730610fe5ac0a9f03f025ef9367c95
)
)

Imagick version

Imagick version

$version = Imagick::IMAGICK_EXTNUM;

echo $version;

( 30001 )

Imagick version

Imagick version

$version = Imagick::IMAGICK_EXTVER;

echo $version;

( 3.0.1 )

Implode image

Creates a new image that is a copy of an existing one with the image pixels "imploded" by the specified percentage.

Implode image example
$im = new Imagick($input);
$im->implodeImage( 10 );
$im->writeImage('implodeImage.jpg'); 
$im->destroy();

Import image pixels

Imports pixels from an array into an image.


( The map is usually 'RGB'. This method imposes the following constraints for the parameters: amount of pixels in the array must match width x height x length of the map. )