略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ImagickPixel::getColorCount

2024-12-21

ImagickPixel::getColorCount

(PECL imagick 2, PECL imagick 3)

ImagickPixel::getColorCountReturns the color count associated with this color

说明

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()

参数

此函数没有参数。

返回值

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

范例

示例 #1 ImagickPixel getColorCount()

<?php
    $imagick 
= new \Imagick();
    
$imagick->newPseudoImage(640480"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
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/imagickpixel.getcolorcount.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3