Graphics::Magick::ColorHistogram - Calculate color frequency with optional quantization
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
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.
None by default, histogram at request.
histogram
See http://www.graphicsmagick.org/quantize.html for information on how the quantization is performed.
Adam Thomason, <athomason@cpan.org>
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.
To install Graphics::Magick::ColorHistogram, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Graphics::Magick::ColorHistogram
CPAN shell
perl -MCPAN -e shell install Graphics::Magick::ColorHistogram
For more information on module installation, please visit the detailed CPAN module installation guide.