image_compare 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +23 -16
- data/lib/image_compare/version.rb +1 -1
- metadata +18 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6e3942a469787d0362555e95b4378fdac7c9766c06b70e0c176e916e0732b22
|
4
|
+
data.tar.gz: acf47bab2a4eee7d2909e7947062e769480c9f1aeceecf809ceeb679287585b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9f2df2f4b996aab9219920b7ee030bd0873b7e6103aff0871e5a161af7ba72d94f96e5431fa3b88dc8c7e046a8727322c2fee80d899d2b95efbd33e05867376
|
7
|
+
data.tar.gz: 8f879179dc1a0f30def7dd4187ff2bbf9d9716f8fa52a14260efaae107b48e6e4327712c9524666010167f069a229e6d8a5bb855a6d1f072295a6948c39eb1e9
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
## main
|
4
4
|
- v1.0.0: Add Color mode to generate "normal" diff images ([@gsguma][], [@cristianofmc][])
|
5
5
|
- v1.0.1: Fix all code smells and integration tests ([@gsguma][])
|
6
|
+
- v1.0.2: Fix gem documentation uri ([@gsguma][])
|
7
|
+
- v1.0.3: Fix documentation ([@gsguma][])
|
8
|
+
- v1.0.4: Fix gem documentation images ([@gsguma][])
|
6
9
|
|
7
10
|
[@gsguma]: https://github.com/gsguma
|
8
11
|
[@cristianofmc]: https://github.com/cristianofmc
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
[![Gem Version](https://
|
2
|
-
[![Build](https://github.com/instantink/image_compare/workflows/Build/badge.svg)](https://github.com/instantink/image_compare/actions)
|
1
|
+
[![Gem Version](https://d25lcipzij17d.cloudfront.net/badge.svg?id=rb&r=r&type=6e&v=1.0.3&x2=0)](https://rubygems.org/gems/image_compare)
|
3
2
|
|
4
3
|
# ImageCompare
|
5
4
|
|
@@ -8,7 +7,7 @@ This is an utility library for image regression testing.
|
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
11
|
-
Add this line to your application
|
10
|
+
Add this line to your application's Gemfile:
|
12
11
|
|
13
12
|
```ruby
|
14
13
|
gem "image_compare"
|
@@ -33,10 +32,19 @@ ImageCompare supports different ways (_modes_) of comparing images.
|
|
33
32
|
|
34
33
|
Source images used in examples:
|
35
34
|
|
35
|
+
a1.png
|
36
|
+
|
36
37
|
<img alt="a.png" src="spec/fixtures/a.png" />
|
38
|
+
|
39
|
+
b.png
|
40
|
+
|
37
41
|
<img alt="b.png" src="spec/fixtures/b.png" />
|
38
42
|
|
39
|
-
|
43
|
+
a1.png
|
44
|
+
|
45
|
+
<img alt="a1.png" src="spec/fixtures/a1.png" />
|
46
|
+
|
47
|
+
### Base (Color) mode (a.png X a1.png)
|
40
48
|
|
41
49
|
Compare pixels, resulting score is a ratio of unequal pixels (with respect to provided tolerance).
|
42
50
|
|
@@ -44,27 +52,27 @@ Resulting diff contains version of the first image with different pixels highlig
|
|
44
52
|
|
45
53
|
<img alt="color_diff" src="spec/fixtures/color_diff.png" />
|
46
54
|
|
47
|
-
###
|
55
|
+
### RGB mode (a.png X b.png)
|
48
56
|
|
49
57
|
Compare pixels by values, resulting score is a ratio of unequal pixels.
|
50
58
|
Resulting diff represents per-channel difference.
|
51
59
|
|
52
|
-
<img alt="rgb_diff.png" src="spec/fixtures/rgb_diff.png"
|
60
|
+
<img alt="rgb_diff.png" src="spec/fixtures/rgb_diff.png" />
|
53
61
|
|
54
|
-
### Grayscale mode
|
62
|
+
### Grayscale mode (a.png X a1.png)
|
55
63
|
|
56
64
|
Compare pixels as grayscale (by brightness and alpha), resulting score is a ratio of unequal pixels (with respect to provided tolerance).
|
57
65
|
|
58
66
|
Resulting diff contains grayscale version of the first image with different pixels highlighted in red and red bounding box.
|
59
67
|
|
60
|
-
<img alt="grayscale_diff.png" src="spec/fixtures/grayscale_diff.png"
|
68
|
+
<img alt="grayscale_diff.png" src="spec/fixtures/grayscale_diff.png" />
|
61
69
|
|
62
|
-
### Delta
|
70
|
+
### Delta (a.png X a1.png)
|
63
71
|
|
64
72
|
Compare pixels using [Delta E](https://en.wikipedia.org/wiki/Color_difference) distance.
|
65
73
|
Resulting diff contains grayscale version of the first image with different pixels highlighted in red (with respect to diff score).
|
66
74
|
|
67
|
-
<img alt="delta_diff.png" src="spec/fixtures/delta_diff.png"
|
75
|
+
<img alt="delta_diff.png" src="spec/fixtures/delta_diff.png" />
|
68
76
|
|
69
77
|
## Usage
|
70
78
|
|
@@ -111,19 +119,18 @@ res.match? #=> true
|
|
111
119
|
res.score #=> 0.0
|
112
120
|
```
|
113
121
|
|
114
|
-
## Excluding rectangle
|
122
|
+
## Excluding rectangle (a.png X a1.png)
|
115
123
|
|
116
|
-
<img alt="
|
117
|
-
<img alt="a1.png" src="spec/fixtures/a1.png" />
|
124
|
+
<img alt="a1.png" src="spec/fixtures/rgb_exclude_rect.png" />
|
118
125
|
|
119
126
|
You can exclude rectangle from comparing by passing `:exclude_rect` to `compare`.
|
120
127
|
E.g., if `path_1` and `path_2` contain images above
|
121
128
|
```ruby
|
122
|
-
ImageCompare.compare("path/image1.png", "path/image2.png", exclude_rect: [200, 150, 275, 200]).match? # => true
|
129
|
+
ImageCompare.compare("path/image1.png", "path/image2.png", mode: :rgb, exclude_rect: [200, 150, 275, 200]).match? # => true
|
123
130
|
|
124
131
|
# or
|
125
132
|
|
126
|
-
cmp = ImageCompare::Matcher.new exclude_rect: [200, 150, 275, 200]
|
133
|
+
cmp = ImageCompare::Matcher.new mode: :rgb, exclude_rect: [200, 150, 275, 200]
|
127
134
|
res = cmp.compare("path/image1.png", "path/image2.png")
|
128
135
|
res #=> ImageCompare::Result
|
129
136
|
res.match? #=> true
|
@@ -185,7 +192,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/instan
|
|
185
192
|
- `rake rubocop`
|
186
193
|
- `rake rubocop:md`
|
187
194
|
- `rake spec`
|
188
|
-
- `ruby examples/performance.rb` Create the gemfile.local file with the content below to run the performance tests:
|
195
|
+
- `ruby examples/performance.rb` Create the "gemfile.local" file with the content below to run the performance tests:
|
189
196
|
```ruby
|
190
197
|
# frozen_string_literal: true
|
191
198
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cristianofmc
|
@@ -15,44 +15,50 @@ dependencies:
|
|
15
15
|
name: chunky_png
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '1.4'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '1.4'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '13.0'
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 13.0.6
|
35
38
|
type: :development
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - "~>"
|
40
43
|
- !ruby/object:Gem::Version
|
41
44
|
version: '13.0'
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 13.0.6
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: rspec
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
|
-
- - "
|
52
|
+
- - "~>"
|
47
53
|
- !ruby/object:Gem::Version
|
48
|
-
version: '3.
|
54
|
+
version: '3.12'
|
49
55
|
type: :development
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
52
58
|
requirements:
|
53
|
-
- - "
|
59
|
+
- - "~>"
|
54
60
|
- !ruby/object:Gem::Version
|
55
|
-
version: '3.
|
61
|
+
version: '3.12'
|
56
62
|
description: Image comparison lib built on top of ChunkyPNG
|
57
63
|
email:
|
58
64
|
- cristiano.fmc@hotmail.com
|
@@ -85,7 +91,7 @@ licenses:
|
|
85
91
|
metadata:
|
86
92
|
bug_tracker_uri: https://github.com/instantink/image_compare/issues
|
87
93
|
changelog_uri: https://github.com/instantink/image_compare/blob/master/CHANGELOG.md
|
88
|
-
documentation_uri: https://
|
94
|
+
documentation_uri: https://www.rubydoc.info/gems/image_compare/1.0.4
|
89
95
|
homepage_uri: https://github.com/instantink/image_compare
|
90
96
|
source_code_uri: https://github.com/instantink/image_compare
|
91
97
|
post_install_message:
|