https://github.com/quadule/colorscore
Finds the dominant colors in an image and scores them against a user-defined palette, using the CIE2000 Delta E formula.
https://github.com/quadule/colorscore
Last synced: 12 months ago
JSON representation
Finds the dominant colors in an image and scores them against a user-defined palette, using the CIE2000 Delta E formula.
- Host: GitHub
- URL: https://github.com/quadule/colorscore
- Owner: quadule
- Created: 2011-08-21T04:24:39.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2017-03-27T07:30:42.000Z (about 9 years ago)
- Last Synced: 2025-06-26T05:06:10.782Z (12 months ago)
- Language: Ruby
- Homepage:
- Size: 70.3 KB
- Stars: 85
- Watchers: 2
- Forks: 26
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Colorscore
Colorscore is a simple library that uses ImageMagick to quantize an image and find its representative colors. It can also score those colors against a palette using the CIE2000 Delta E formula. This could be used to index images for a "search by color" feature.
## Requirements
* ImageMagick 6.5+
## Usage
```ruby
include Colorscore
histogram = Histogram.new('test/fixtures/skydiver.jpg')
# This image is 78.8% #7a9ab5:
histogram.scores.first # => [0.7884625, RGB [#7a9ab5]]
# This image is closest to pure blue:
palette = Palette.from_hex(['ff0000', '00ff00', '0000ff'])
scores = palette.scores(histogram.scores, 1)
scores.first # => [0.16493763694876, RGB [#0000ff]]
```