web_image_compare 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chunky_png/operations.rb +1 -3
- data/lib/web_image_compare/version.rb +1 -1
- data/lib/web_image_compare.rb +2 -2
- data/spec/web_image_compare_spec.rb +10 -1
- data/web_image_compare.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4845598c0a82448f38db553936242d84e01322b6
|
4
|
+
data.tar.gz: 8ac6d3d491256a6e881eb8519653fbadea8b221e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7c379bda5dcded22943eef2791eda7a96e3298427ccbc68e0ca1e3c45883c544ef19fd82425f74e4109f1432fcfd36f207a53b89b71fff100eef941472cf640
|
7
|
+
data.tar.gz: e16d174ce0f21506d663bdde87cfaf90d0ddaa36f47990035986e34afa33a399a0c1acb6bf7669b023b102a5bb17114d64994d76471169f2c7e6f58bc8f8054e
|
@@ -3,8 +3,6 @@ module ChunkyPNG
|
|
3
3
|
class Canvas
|
4
4
|
# Module operations
|
5
5
|
module Operations
|
6
|
-
include ChunkyPNG::Color
|
7
|
-
|
8
6
|
# Performs the image comparison pixel by pixel
|
9
7
|
#
|
10
8
|
# @param [String] result_img complete path to where is intended save the image
|
@@ -35,7 +33,7 @@ module ChunkyPNG
|
|
35
33
|
|
36
34
|
def pixel_difference(pixel_1, pixel_2)
|
37
35
|
Math.sqrt(
|
38
|
-
(r(pixel_1) - r(pixel_2))**2 +
|
36
|
+
(r(pixel_1) - Color.r(pixel_2))**2 +
|
39
37
|
(g(pixel_1) - g(pixel_2))**2 +
|
40
38
|
(b(pixel_1) - b(pixel_2))**2
|
41
39
|
) / Math.sqrt(MAX**2 * 3)
|
data/lib/web_image_compare.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative '../lib/web_image_compare'
|
2
2
|
|
3
3
|
describe WebImageCompare do
|
4
4
|
describe '.new' do
|
@@ -15,4 +15,13 @@ describe WebImageCompare do
|
|
15
15
|
compare_image.process_image(false, {}).should eq(0.0)
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
describe '.process_image' do
|
20
|
+
it 'The images don\'t match' do
|
21
|
+
image_path_1 = File.dirname(__FILE__) + '/images/example_image.png'
|
22
|
+
image_path_2 = File.dirname(__FILE__) + '/images/example_image_2.png'
|
23
|
+
compare_image = WebImageCompare.new(image_path_1, image_path_2)
|
24
|
+
compare_image.process_image(false, {}).should_not eq(0.0)
|
25
|
+
end
|
26
|
+
end
|
18
27
|
end
|
data/web_image_compare.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_development_dependency 'rspec', '~> 3.0', '>= 3.0.0'
|
24
24
|
s.add_development_dependency 'rubocop', '~> 0.24', '>= 0.24.1'
|
25
25
|
s.add_development_dependency 'rake', '~> 10.4'
|
26
|
+
s.add_development_dependency 'pry', '~> 0.10'
|
26
27
|
s.add_development_dependency 'yard', '~> 0.8'
|
27
28
|
|
28
29
|
s.add_runtime_dependency 'oily_png', '~> 1.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_image_compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rui Nunes
|
@@ -64,6 +64,20 @@ dependencies:
|
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '10.4'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: pry
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0.10'
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - "~>"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0.10'
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
name: yard
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|