首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Imagick::exportImagePixels

(No version information available, might only be in Git)

Imagick::exportImagePixels — Exports raw image pixels

Description

代码语言:javascript
复制
public array Imagick::exportImagePixels ( int $x , int $y , int $width , int $height , string $map , int $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). This method is available if Imagick has been compiled against ImageMagick version 6.4.7 or newer.

Parameters

x

X-coordinate of the exported area

y

Y-coordinate of the exported area

width

Width of the exported aread

height

Height 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.

STORAGE

Refer to this list of pixel type constants

Examples

Example #1 Using Imagick::exportImagePixels()

Export image pixels into an array

代码语言:javascript
复制
<?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);
?>

The above example will output:

代码语言:javascript
复制
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)
}

Return Values

Returns an array containing the pixels values.

Errors/Exceptions

Throws ImagickException on error.

← Imagick::evaluateImage

Imagick::extentImage →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com