We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello
Here is a proposition for Imagick integration in Palette.
/** * @param \Imagick $image * * @return Palette * * @throws \InvalidArgumentException */ public static function fromImagick(\Imagick $image) { if (!is_object($image) || $image instanceof \Imagick === FALSE) { throw new \InvalidArgumentException('Image must be an Imagick instance'); } $palette = new self(); $palette->colors = []; $iterator = $image->getPixelIterator(); foreach($iterator as $row) { foreach($row as $pixel) { $colorInfo = $pixel->getColor(); $color = ($colorInfo['r'] * 65536) + ($colorInfo['g'] * 256) + ($colorInfo['b']); isset($palette->colors[$color]) ? $palette->colors[$color] += 1 : $palette->colors[$color] = 1; } } arsort($palette->colors); return $palette; }
The text was updated successfully, but these errors were encountered:
How about iterating on getImageHistogram?
getImageHistogram
Sorry, something went wrong.
Well I'll be testing that.
No branches or pull requests
Hello
Here is a proposition for Imagick integration in Palette.
The text was updated successfully, but these errors were encountered: