note 109287 added to imagick.getimagerenderingintent
| From: | holdoffhunger at gmail dot com | Date: | Mon, 02 Jul 2012 18:19:38 +0000 |
| Subject: | note 109287 added to imagick.getimagerenderingintent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-189012@lists.php.net to get a copy of this message | ||
The Rendering Intent variable exists in ImageMagick to provide support for ICC Color Profiles.
There are five results that one can expect to get from the getRenderingIntent function, which are
the predefined constants for Rendering Intent within ImageMagick. These values look like
"imagick::RENDERINGINTENT_UNDEFINED", with "_VALUE" values of: undefined,
saturation, perceptual, absolute, and relative. Printed out, Undefined is 0, Saturation is 1,
Perceptual is 2, Absolute is 3, and Relative is 4.
The official ImageMagick documentation provides good light on what these values indicate. ( http://www.imagemagick.org/RMagick/doc/constants.html#RenderingIntent
) Undefined means "no intent," Saturation means "A rendering intent that specifies
the saturation of the pixels in the image is preserved perhaps at the expense of accuracy in hue and
lightness," Perceptual Intent means "A rendering intent that specifies the full gamut of
the image is compressed or expanded to fill the gamut of the destination device. Gray balance is
preserved but colorimetric accuracy might not be preserved," Absolute Intent means
"Absolute colorimetric," and Relative Intent means "Relative colorimetric."
Every time I ran this function, it always produced the same result: #2, indicating Perceptual
Intent. But this makes sense, since the ImageMagick documentation notes about the Rendering Intent,
"Typically, the user or application will set the rendering intent dynamically at runtime or
embedding time." The ImageMagick documentation also recommended the following link to better
understand Rendering Intent in terms of Colorspace Profiles: http://www.cambridgeincolour.com/tutorials/color-space-conversion.htm
.
Some sample code :
<?php
// Author: holdoffhunger@gmail.com
// Imagick Type
// ---------------------------------------------
$imagick_type = new Imagick();
// Open File
// ---------------------------------------------
$file_to_grab = "image_workshop_directory/test.jpg";
$file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
// Grab File
// ---------------------------------------------
$imagick_type->readImageFile($file_handle_for_viewing_image_file);
// Get Rendering Intent Values
// ---------------------------------------------
$imagick_rendering_intent = $imagick_type->getImageRenderingIntent();
switch($imagick_rendering_intent)
{
case '0':
$image_rendering_intent_evaluated = "Undefined";
break;
case '1':
$image_rendering_intent_evaluated = "Saturation";
break;
case '2':
$image_rendering_intent_evaluated = "Perceptual";
break;
case '3':
$image_rendering_intent_evaluated = "Absolute";
break;
case '4':
$image_rendering_intent_evaluated = "Relative";
break;
}
// Print Rendering Intent Values
// ---------------------------------------------
print("# $imagick_rendering_intent - $image_rendering_intent_evaluated");
?>
----
Server IP: 69.147.83.197
Probable Submitter: 68.9.137.178
----
Manual Page -- http://www.php.net/manual/en/imagick.getimagerenderingintent.php
Edit -- https://master.php.net/note/edit/109287
Del: integrated -- https://master.php.net/note/delete/109287/integrated
Del: useless -- https://master.php.net/note/delete/109287/useless
Del: bad code -- https://master.php.net/note/delete/109287/bad+code
Del: spam -- https://master.php.net/note/delete/109287/spam
Del: non-english -- https://master.php.net/note/delete/109287/non-english
Del: in docs -- https://master.php.net/note/delete/109287/in+docs
Del: other reasons-- https://master.php.net/note/delete/109287
Reject -- https://master.php.net/note/reject/109287
Search -- https://master.php.net/manage/user-notes.php