note 108635 added to imagick.getquantumdepth
| From: | holdoffhunger at gmail dot com | Date: | Sat, 12 May 2012 22:10:47 +0000 |
| Subject: | note 108635 added to imagick.getquantumdepth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187957@lists.php.net to get a copy of this message | ||
The getQuantumDepth works much like the other "Depth" functions and much like the
getQuantumRange function. Like the Depth functions, it returns a value indicating the number of
bits to store the unique color values -- 16-bit = 2^16 unique colors, which is 65,535 (counting
starts at '0' in binary, as opposed to '1' in decimal). Like the
getQuantumRange function, it returns an array with two values, one being a long integer
('quantumDepthLong') and the other being a string ('quantumDepthLong'). The
only difference, besides the variable types, is that the string version has a 'Q' prefixed
to it.
Here's some sample code and the results, given a color, BMP file photograph that is 600x450
pixels...
<?php
// Author: holdoffhunger@gmail.com
// Imagick Type
// ---------------------------------------------
$imagick_type = new Imagick();
// Open File
// ---------------------------------------------
$file_to_grab = "image_workshop_directory/test.bmp";
$file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
// Grab File
// ---------------------------------------------
$imagick_type->readImageFile($file_handle_for_viewing_image_file);
// Get Quantum Depth
// ---------------------------------------------
$imagick_type_quantum_depth = $imagick_type->getQuantumDepth();
// Print Results
// ---------------------------------------------
print("<pre>");
print_r($imagick_type_quantum_depth);
print("</pre>");
?>
Output:
Array
(
[quantumDepthLong] => 16
[quantumDepthString] => Q16
)
----
Server IP: 69.147.83.197
Probable Submitter: 68.9.137.178
----
Manual Page -- http://www.php.net/manual/en/imagick.getquantumdepth.php
Edit -- https://master.php.net/note/edit/108635
Del: integrated -- https://master.php.net/note/delete/108635/integrated
Del: useless -- https://master.php.net/note/delete/108635/useless
Del: bad code -- https://master.php.net/note/delete/108635/bad+code
Del: spam -- https://master.php.net/note/delete/108635/spam
Del: non-english -- https://master.php.net/note/delete/108635/non-english
Del: in docs -- https://master.php.net/note/delete/108635/in+docs
Del: other reasons-- https://master.php.net/note/delete/108635
Reject -- https://master.php.net/note/reject/108635
Search -- https://master.php.net/manage/user-notes.php