ImagickPixelIterator::getNextIteratorRow

(PECL imagick 2, PECL imagick 3)

ImagickPixelIterator::getNextIteratorRowpixel iterator の次の行を返す

説明

public ImagickPixelIterator::getNextIteratorRow(): array
警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

pixel iterator の次の行を、pixel wands の配列として返します。

戻り値

次の行を ImagickPixel オブジェクトの配列で返します。 エラー時には ImagickPixelIteratorException をスローします。

例1 ImagickPixelIterator::getNextIteratorRow()

<?php
function getNextIteratorRow($imagePath) {
$imagick = new \Imagick(realpath($imagePath));
$imageIterator = $imagick->getPixelIterator();

$count = 0;
while (
$pixels = $imageIterator->getNextIteratorRow()) {
if ((
$count % 3) == 0) {
/* Loop through the pixels in the row (columns) */
foreach ($pixels as $column => $pixel) {
/** @var $pixel \ImagickPixel */
if ($column % 2) {
/* Paint every second pixel black*/
$pixel->setColor("rgba(0, 0, 0, 0)");
}
}
/* Sync the iterator, this is important to do on each iteration */
$imageIterator->syncIterator();
}

$count += 1;
}

header("Content-Type: image/jpg");
echo
$imagick;
}

?>