ColorThief\Image\Adapter\ImagickImageAdapter::getPixelColor PHP Method

getPixelColor() public method

public getPixelColor ( $x, $y )
    public function getPixelColor($x, $y)
    {
        $pixel = $this->resource->getImagePixelColor($x, $y);
        // Un-normalized values don't give a full range 0-1 alpha channel
        // So we ask for normalized values, and then we un-normalize it ourselves.
        $colorArray = $pixel->getColor(true);
        $color = new \stdClass();
        $color->red = round($colorArray['r'] * 255);
        $color->green = round($colorArray['g'] * 255);
        $color->blue = round($colorArray['b'] * 255);
        $color->alpha = 127 - round($colorArray['a'] * 127);
        return $color;
    }