imagga 0.0.2 → 0.0.3
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.
- data/README.md +20 -0
- data/lib/imagga/image.rb +3 -0
- data/lib/imagga/version.rb +1 -1
- data/spec/lib/image_color_spec.rb +8 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -32,6 +32,7 @@ Extract image information
|
|
32
32
|
|
33
33
|
results = client.extract('http://imagga.com/images/scheme_colors.png')
|
34
34
|
|
35
|
+
|
35
36
|
Extract image information with indexing and extraction options:
|
36
37
|
|
37
38
|
results = client.extract(
|
@@ -43,6 +44,25 @@ Extract image information with indexing and extraction options:
|
|
43
44
|
extract_object_colors: false
|
44
45
|
)
|
45
46
|
|
47
|
+
Check the results, for example:
|
48
|
+
|
49
|
+
results.each do |info| # iterate over all input image infos
|
50
|
+
puts info.object_percentage # percentage of the central object on image
|
51
|
+
info.image_colors.each do |color| # iterate over all significant colors
|
52
|
+
puts color.info # 85.89%, rgb: (246,246,246), hex: #f6f6f6
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
Multi-color search:
|
57
|
+
|
58
|
+
client.rank(
|
59
|
+
color_vector: '20,82,37,43,30,20,30,10', # vector of colors (percentage, r, g, b)
|
60
|
+
type: 'object',
|
61
|
+
dist: 6000,
|
62
|
+
count: 10
|
63
|
+
).each do |similarity|
|
64
|
+
puts "Distance of #%i is %.4f" % [similarity.id, similarity.dist] # Distance of #333 is 3581.5500
|
65
|
+
end
|
46
66
|
|
47
67
|
## Contributing
|
48
68
|
|
data/lib/imagga/image.rb
CHANGED
data/lib/imagga/version.rb
CHANGED
@@ -11,8 +11,15 @@ describe Imagga::ImageColor do
|
|
11
11
|
"closest_palette_distance" => 2.03931376316
|
12
12
|
} }
|
13
13
|
|
14
|
+
subject { described_class.new(init_hash) }
|
15
|
+
|
16
|
+
describe "#info" do
|
17
|
+
it "shows overview of the color" do
|
18
|
+
subject.info.should == '19.29%, rgb: (174,180,187), hex: #aeb4bb'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
14
22
|
describe "initialized by hash" do
|
15
|
-
subject { described_class.new(init_hash) }
|
16
23
|
|
17
24
|
it "has percent" do
|
18
25
|
subject.percent.should == 19.29
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
@@ -137,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
segments:
|
139
139
|
- 0
|
140
|
-
hash:
|
140
|
+
hash: 1906087538434497145
|
141
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
142
|
none: false
|
143
143
|
requirements:
|
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
version: '0'
|
147
147
|
segments:
|
148
148
|
- 0
|
149
|
-
hash:
|
149
|
+
hash: 1906087538434497145
|
150
150
|
requirements: []
|
151
151
|
rubyforge_project:
|
152
152
|
rubygems_version: 1.8.25
|