jnylen-colorscore 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aa628a12c958769b9f8e4dfa9fe4f8b436e42e8
4
- data.tar.gz: 6bfcd87069d5461451e08bc88f05507d9004fc36
3
+ metadata.gz: 41850e99437a7328d6e7edc19576b2d1776077db
4
+ data.tar.gz: 828d20cbb163ed24b648c8cd0e85f49fffc9f0e0
5
5
  SHA512:
6
- metadata.gz: 2b26dfc2e43aa85dea7693f4a4c88ea6b3f125912a9be0a484d3c99445937fa529da2ade54ced4a86caffd4aff1d8c3a0c1ea92d8a73f6b990f017843de8bb5f
7
- data.tar.gz: dea93b215d1eaf5d6e271dfa158b420c0eb7cee7d738b541a2da8295060718bed57ce7454e088c35dfb5597e5f8ad8e3599ba0233e9fdfbcd707b044adb9bee8
6
+ metadata.gz: 92c4e8f29715442f4899cb0cbb6913d3702f7a8374b3dd293227064d2c1b921259583600822dce56ec90ea21e8f016e9156b1eba1467afe83f85358c24654b0d
7
+ data.tar.gz: 6d4b95007e931d211f18d2855ccc25345e291acbe8302fc78312c7f69ff098d4ec4e3701f101390532060c004988909af4fea01c47210a375f20ef8472e96542
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ Major change from normal colorscore: .colors is .hex_colors.
2
+
1
3
  # Colorscore
2
4
 
3
5
  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.
@@ -19,4 +21,4 @@ histogram.scores.first # => [0.7884625, RGB [#7a9ab5]]
19
21
  palette = Palette.from_hex(['ff0000', '00ff00', '0000ff'])
20
22
  scores = palette.scores(histogram.scores, 1)
21
23
  scores.first # => [0.16493763694876, RGB [#0000ff]]
22
- ```
24
+ ```
@@ -6,7 +6,7 @@ module Colorscore
6
6
  params = [
7
7
  '-resize 400x400',
8
8
  '-format %c',
9
- "-dither #{options.fetch(:dither) { 'None' }}"
9
+ "-dither #{options.fetch(:dither) { 'None' }}",
10
10
  "-quantize #{options.fetch(:quantize) { 'YIQ' }}",
11
11
  "-colors #{options.fetch(:colors) { 16 }.to_i}",
12
12
  "-depth #{options.fetch(:depth) { 8 }.to_i}",
@@ -37,7 +37,7 @@ module Colorscore
37
37
  def scores
38
38
  total = color_counts.inject(:+).to_f
39
39
  scores = color_counts.map { |count| count / total }
40
- scores.zip(colors)
40
+ scores.zip(hex_colors)
41
41
  end
42
42
  end
43
43
  end
@@ -1,3 +1,3 @@
1
1
  module Colorscore
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -3,12 +3,12 @@ require File.expand_path("../test_helper", __FILE__)
3
3
  class HistogramTest < Test::Unit::TestCase
4
4
  def test_color_count_is_correct
5
5
  colors = 7
6
- histogram = Histogram.new("test/fixtures/skydiver.jpg", colors)
7
- assert_operator histogram.colors.size, :<=, colors
6
+ histogram = Histogram.new("test/fixtures/skydiver.jpg", :colors => colors)
7
+ assert_operator histogram.hex_colors.size, :<=, colors
8
8
  end
9
9
 
10
10
  def test_transparency_is_ignored
11
11
  histogram = Histogram.new("test/fixtures/transparency.png")
12
- assert_equal Color::RGB.from_html('0000ff'), histogram.colors.first
12
+ assert_equal Color::RGB.from_html('0000ff'), histogram.hex_colors.first
13
13
  end
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jnylen-colorscore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Nylén