The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Image::DominantColors - Find dominant colors in an image with k-means clustering.

VERSION

Version 0.01

SYNOPSIS

This module does just one simple thing. It scans an image and clusters colors with the k-means clustering algorithm to give you the most dominant colors in that image.

Here is a live demo : http://www.tryperl.com/dominantcolors/

This is how it works, I would advise leaving the clusters to a default 3 which works best with images.:

    use Image::DominantColors;
    use Data::Dumper;
    
    
    my $dmt = Image::DominantColors->new({file => 'some_path/img.jpg', clusters => 4});
    #OR three clusters is default
    my $dmt = Image::DominantColors->new({file => 'some_path/img.jpg'});
    my $r = $dmt->getDominantColors();
    
    print Dumper($r);
        #This outputs the following:
    # [
    #           {
    #             'r' => 31,
    #             'b' => 23,
    #             'g' => 15
    #           },
    #           {
    #             'r' => 193,
    #             'b' => 41,
    #             'g' => 84
    #           },
    #           {
    #             'r' => 114,
    #             'b' => 136,
    #             'g' => 128
    #           },
    #           {
    #             'r' => 61,
    #             'b' => 82,
    #             'g' => 66
    #           }
    # ];
    ...

EXPORT

A list of functions that can be exported. You can delete this section if you don't export anything, such as for a purely object-oriented module.

SUBROUTINES/METHODS

getDominantColors

    This is the only user function the module contains. it returns an array of hashes as in the synopsis.

AUTHOR

Gideon Israel Dsouza, <gideon at cpan.org>

BUGS

Please report any bugs or feature requests to bug-image-dominantcolors at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Image-DominantColors. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Image::DominantColors

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2013 Gideon Israel Dsouza.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0