array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'it', ), 'this' => array ( 0 => 'imagickpixel.getcolorcount.php', 1 => 'ImagickPixel::getColorCount', 2 => 'Returns the color count associated with this color', ), 'up' => array ( 0 => 'class.imagickpixel.php', 1 => 'ImagickPixel', ), 'prev' => array ( 0 => 'imagickpixel.getcolorasstring.php', 1 => 'ImagickPixel::getColorAsString', ), 'next' => array ( 0 => 'imagickpixel.getcolorquantum.php', 1 => 'ImagickPixel::getColorQuantum', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/imagick/imagickpixel/getcolorcount.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

ImagickPixel::getColorCount

(PECL imagick 2, PECL imagick 3)

ImagickPixel::getColorCountReturns the color count associated with this color

Descrizione

public ImagickPixel::getColorCount(): int

Returns the color count associated with this color.

The color count is the number of pixels in the image that have the same color as this ImagickPixel.

ImagickPixel::getColorCount appears to only work for ImagickPixel objects created through Imagick::getImageHistogram()

Elenco dei parametri

Questa funzione non contiene parametri.

Valori restituiti

Returns the color count as an integer on success, throws ImagickPixelException on failure.

Esempi

Example #1 ImagickPixel getColorCount()

<?php
$imagick
= new \Imagick();
$imagick->newPseudoImage(640, 480, "magick:logo");
$histogramElements = $imagick->getImageHistogram();
$lastColor = array_pop($histogramElements);
echo
"Last pixel color count is: ".$lastColor->getColorCount();
?>

The output for this will be similar to:

Last pixel color count is: 256244