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

Get image property

Returns the named image property.

Imagick

$im = new Imagick();
$im->newImage(300, 200, "black");
$im->setImageProperty('Exif:Make', 'Imagick');
echo $im->getImageProperty('Exif:Make');

Get image red primary

Returns the chromaticity red primary point as an array with the keys "x" and "y".

Array ( [x] => 0.63999998569489 [y] => 0.33000001311302 ) Red primary = 1

$im = new Imagick($input);
$redPrimary = $im->getImageRedPrimary();
echo "Red primary = ". print_r($redPrimary);

Get image region

Extracts a region of the image and returns it as a new Imagick object.

Get image rendering intent

Gets the image rendering intent.

Get image resolution

Gets the image X and Y resolution.

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

$im = new Imagick($input);
$resolution = $im->getImageResolution();
print_r($resolution);

Get image scene

Gets the image scene.

Get image signature

Generates an SHA-256 message digest for the image pixel stream.

Image signature = 9a3098f2a9f9f5819d67d373266e9fddd749040971d63e59b27730cf56cd2162

$im = new Imagick($input);
$signature = $im->getImageSignature();
echo "
Image signature = $signature";

Get image size

Returns the image length in bytes.

Image size = 16345

$im = new Imagick($input);
$size = $im->getImageSize();
echo "
Image size = $size";

Get image ticks per second

Gets the image ticks-per-second.

Get image total ink density

Gets the image total ink density.

Get image type

Gets the potential image type.

The image type is 6

$im = new Imagick($input);
$type = $im->getImageType();
echo "The image type is ".$type;

Get image units

Gets the image units of resolution.

Get image virtual pixel method

Returns the virtual pixel method for the specified image.

Get image white point

Returns the chromaticity white point as an associative array with the keys "x" and "y".

Array ( [x] => 0 [y] => 0 )

$im = new Imagick($input);
$whitePoint = $im->getImageWhitePoint();
print_r($whitePoint);