NAME
Graphics::Magick::ColorHistogram - Calculate color frequency with optional quantization
SYNOPSIS
use Graphics::Magick::ColorHistogram 'histogram';
# calculate frequency of color in an image
$counts = histogram("image.png"); # { aa77ff => 60, ... }
# quantize image first then count
$counts = histogram("image.jpg", 2); # at most two colors
FUNCTIONS
- histogram($filename, [$max_colors])
-
This routine counts the number of times each present color appears in an image. Optionally, a number of colors can be given and the image data will first be quantized to have no more than that many colors in it.
The return value is a hashref which maps hex RGB triplets to counts.
EXPORTS
None by default, histogram
at request.
SEE ALSO
See http://www.graphicsmagick.org/quantize.html for information on how the quantization is performed.
AUTHOR
Adam Thomason, <athomason@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2011 by Say Media Inc <cpan@saymedia.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.9 or, at your option, any later version of Perl 5 you may have available.