These are the letters for the map:
R = red
G = green
B = blue
A = alpha (0 is transparent)
O = alpha (0 is opaque)
C = cyan
Y = yellow
M = magenta
K = black
I = intensity (for grayscale)
P = pad(PECL imagick 2 >=2.3.0, PECL imagick 3)
Imagick::exportImagePixels — Exports raw image pixels
$x,$y,$width,$height,$map,$STORAGE
Exports image pixels into an array. The map defines the ordering of the exported
pixels. The size of the returned array is width * height * strlen(map).
Diese Funktion ist verfügbar, wenn Imagick gegen die ImageMagick-Version 6.4.7 oder höher kompiliert wurde.
xX-coordinate of the exported area
yY-coordinate of the exported area
widthWidth of the exported aread
heightHeight of the exported area
map
Ordering of the exported pixels. For example "RGB".
Valid characters for the map are R, G, B, A, O, C, Y, M, K, I and P.
STORAGERefer to this list of pixel type constants
Returns an array containing the pixels values.
Wirft ImagickException bei Fehlern.
Beispiel #1 Using Imagick::exportImagePixels()
Export image pixels into an array
<?php
/* Create new object */
$im = new Imagick();
/* Create new image */
$im->newPseudoImage(0, 0, "magick:rose");
/* Export the image pixels */
$pixels = $im->exportImagePixels(10, 10, 2, 2, "RGB", Imagick::PIXEL_CHAR);
/* Output */
var_dump($pixels);
?>Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
array(12) {
[0]=>
int(72)
[1]=>
int(64)
[2]=>
int(57)
[3]=>
int(69)
[4]=>
int(59)
[5]=>
int(43)
[6]=>
int(124)
[7]=>
int(120)
[8]=>
int(-96)
[9]=>
int(91)
[10]=>
int(84)
[11]=>
int(111)
}