Skip to main content

Determination of the primary colors in an image file.

Project description

Determination of the primary colors in an image file.

Requirements

  • python (>=2.7.0)

  • scipy (>=0.9.0)

License:

primarycolors is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

primary colors is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with primarycolors. If not, see <http://www.gnu.org/licenses/>.

Installation:

$ sudo pip install primarycolors

If you have any difficulty with the installation. Try to install scipy separately. Example for Ubuntu:

$ sudo apt-get install python-scipy

And then:

$ sudo pip install primarycolors

Usage:

>>> from primarycolors import PrimaryColors
>>> im = PrimaryColors()
>>> im.read(image='Lenna.png', max_colors=5)
>>> im.get_hex_colors
['621a43', 'e5bda6', 'd5867b', '9f4257', 'cb6161']
>>> im.get_int_colors
array([[ 98,  26,  67],
       [229, 189, 166],
       [213, 134, 123],
       [159,  66,  87],
       [203,  97,  97]])
>>> im.get_sorted_colors
[('d5867b', 0.2567596435546875),
('cb6161', 0.21997451782226562),
('621a43', 0.19715118408203125),
('9f4257', 0.1964874267578125),
('e5bda6', 0.12962722778320312)]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

primarycolors-0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page