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

Get compression quality

Gets the object compression quality.

Image compression quality = 0

$im = new Imagick($input);
$compressionQuality = $im->getCompression();
echo "
Image compression quality = $compressionQuality";

Get copyright

Returns the ImageMagick API copyright as a string.

Image copyright = Copyright (C) 1999-2009 ImageMagick Studio LLC

$im = new Imagick($input);
$copyright = $im->getCopyright ();
echo "
Image copyright = $copyright";

Get filename

Returns the filename associated with an image sequence.

Image filename = /home/usr/public_html/imagemagick/imagick/temp.jpg

$im = new Imagick($input);
$filename = $im->getImageFilename();
echo "Image filename = $filename
";

Get font

Returns the objects font property.

Font used is = /home/usr/public_html/imagemagick/imagick/arial.ttf

$im = new Imagick($input);
$im->setFont("arial.ttf");
$font_used = $im->getFont();
echo "Font used is = $font_used
";

Get format

Returns the format of the Imagick object.

Image format = JPEG

$im = new Imagick($input);
$format = $im->getImageFormat();
echo "Image format = $format
";

Get gravity

Gets the global gravity property for the Imagick object.

$im = new Imagick($input);
$gravity = $im->getGravity();
echo "Image gravity = $gravity
";

Get home URL

Returns the ImageMagick home URL.

Home URL = /usr/share/doc/ImageMagick-6.4.8//index.html

$home = $im->getHomeURL ();
echo "
Home URL = $home";

Get HSL

Returns the normalized HSL color described by the ImagickPixel object, with each of the three values as floating point numbers between 0.0 and 1.0.

Hue: 0.204427083333
Saturation: 0.914285714286
Luminosity: 0.274509803922

$im = new Imagick($input);
$pixel = $im->getImagePixelColor( 78, 22 );
$hsl = $pixel->getHSL();
echo '
Hue: '.$hsl['hue']; echo '
Saturation: '.$hsl['saturation']; echo '
Luminosity: '.$hsl['luminosity']; $im->destroy();

Get image

Returns a new Imagick object with the current image sequence.

Get image alpha channel

Gets the image alpha channel value.

Image alpha channel = 1

$im = new Imagick('rotateImage.png');
$alpha = $im->getImageAlphaChannel ();
echo "Image alpha channel = $alpha
";

( The returned value is one of the alpha channel constants. )

Get image artifact

Gets an artifact associated with the image.

My version is to old


( The difference between image properties and image artifacts is that properties are public and artifacts are private. )

Get image background color

Returns the image background color.

Get image blob

Implements direct to memory image formats.


( It returns the image sequence as a string. The format of the image determines the format of the returned blob (GIF, JPEG, PNG, etc.). To return a different image format, use Imagick::setImageFormat(). )

Get image blue primary

Returns the chromaticity blue primary point for the image.

Output: Array ( [x] => 0.15000000596046 [y] => 0.059999998658895 ) Blue primary = 1

$im = new Imagick($input);
$bluePrimary = $im->getImageBluePrimary();
echo "Blue primary = ". print_r($bluePrimary);

( )