1--TEST--
2Test importimagepixels
3--SKIPIF--
4<?php require_once(dirname(__FILE__) . '/skipif.inc');
5
6if (!method_exists("imagick", "importimagepixels")) {
7	die("skip imagick::importImagePixels not available");
8}
9
10?>
11--FILE--
12<?php
13
14/* Generate array of pixels. 2000 pixels per color stripe */
15$count = 2000 * 3;
16
17$pixels =
18   array_merge(array_pad(array(), $count, 0),
19               array_pad(array(), $count, 255),
20               array_pad(array(), $count, 0),
21               array_pad(array(), $count, 255),
22               array_pad(array(), $count, 0));
23
24/* Width and height. The area is amount of pixels divided
25   by three. Three comes from 'RGB', three values per pixel */
26$width = $height = 100;
27
28/* Create empty image */
29$im = new Imagick();
30$im->newImage($width, $height, 'gray');
31
32/* Import the pixels into image.
33   width * height * strlen("RGB") must match count($pixels) */
34$im->importImagePixels(0, 0, $width, $height, "RGB", Imagick::PIXEL_CHAR, $pixels);
35
36var_dump($width, $height);
37var_dump($im->getImageGeometry());
38
39?>
40--EXPECTF--
41int(100)
42int(100)
43array(2) {
44  ["width"]=>
45  int(100)
46  ["height"]=>
47  int(100)
48}