Imagick::importImagePixels

(Информация о версии неизвестна, возможно, только в SVN)

Imagick::importImagePixelsImports image pixels

Описание

public bool Imagick::importImagePixels ( int $x , int $y , int $width , int $height , string $map , int $storage , array $pixels )

Imports pixels from an array into an image. The map is usually 'RGB'. This method imposes the following constraints for the parameters: amount of pixels in the array must match width x height x length of the map. Этот метод доступен, если Imagick был скомпилирован с версией ImageMagick 6.4.5 или старше.

Список параметров

x

The image x position

y

The image y position

width

The image width

height

The image height

map

Map of pixel ordering as a string. This can be for example RGB. The value can be any combination or order of R = red, G = green, B = blue, A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad.

storage

The pixel storage method. Refer to this list of pixel constants.

pixels

The array of pixels

Возвращаемые значения

В случае успешной работы возвращает TRUE.

Ошибки

Вызывает ImagickException при ошибке.

Примеры

Пример #1 Imagick::importImagePixels() example

<?php

/* Generate array of pixels. 2000 pixels per color stripe */
$count 2000 3;

$pixels 
   
array_merge(array_pad(array(), $count0),
               
array_pad(array(), $count255), 
               
array_pad(array(), $count0),
               
array_pad(array(), $count255),
               
array_pad(array(), $count0));

/* Width and height. The area is amount of pixels divided
   by three. Three comes from 'RGB', three values per pixel */
$width $height pow((count($pixels) / 3), 0.5);

/* Create empty image */
$im = new Imagick();
$im->newImage($width$height'gray');

/* Import the pixels into image.
   width * height * strlen("RGB") must match count($pixels) */
$im->importImagePixels(00$width$height"RGB"Imagick::PIXEL_CHAR$pixels);

/* output as jpeg image */
$im->setImageFormat('jpg');
header("Content-Type: image/jpg");
echo 
$im;

?>

Результатом выполнения данного примера будет что-то подобное:

Output of example : Imagick::importImagePixels()

Коментарии

404 Not Found

404 Not Found


nginx

    Поддержать сайт на родительском проекте КГБ