image_compare 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -0
- data/README.md +22 -14
- data/lib/image_compare/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efc745c05f8c87808311a102dc55c92e030de6ce85a6512aed95161a817258ce
|
4
|
+
data.tar.gz: a243eda35bc9edf3313a8d34c7ad71ae2a066f3553faada189a58ea9db04c1e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6009fd283629fc28bc28e5ed4a4e74dcf39946e23d16dd0bb03a35ca98fb069f8a5a3279d5b46cd3373550d80cccc7a5fda0c360277062a092c220ba4415827e
|
7
|
+
data.tar.gz: 3ea374f5b4c3e184ee34f9c0ff3aa36c8a400e3923bafa34bd90ca66b79c2da080f606bf31fb31d717496bf045f091eba9d6a7df96eb0283517587615f019233
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,7 @@
|
|
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][])
|
6
7
|
|
7
8
|
[@gsguma]: https://github.com/gsguma
|
8
9
|
[@cristianofmc]: https://github.com/cristianofmc
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ This is an utility library for image regression testing.
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
Add this line to your application
|
11
|
+
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
14
|
gem "image_compare"
|
@@ -33,10 +33,19 @@ ImageCompare supports different ways (_modes_) of comparing images.
|
|
33
33
|
|
34
34
|
Source images used in examples:
|
35
35
|
|
36
|
+
a1.png
|
37
|
+
|
36
38
|
<img alt="a.png" src="spec/fixtures/a.png" />
|
39
|
+
|
40
|
+
b.png
|
41
|
+
|
37
42
|
<img alt="b.png" src="spec/fixtures/b.png" />
|
38
43
|
|
39
|
-
|
44
|
+
a1.png
|
45
|
+
|
46
|
+
<img alt="a1.png" src="spec/fixtures/a1.png" />
|
47
|
+
|
48
|
+
### Base (Color) mode (a.png X a1.png)
|
40
49
|
|
41
50
|
Compare pixels, resulting score is a ratio of unequal pixels (with respect to provided tolerance).
|
42
51
|
|
@@ -44,27 +53,27 @@ Resulting diff contains version of the first image with different pixels highlig
|
|
44
53
|
|
45
54
|
<img alt="color_diff" src="spec/fixtures/color_diff.png" />
|
46
55
|
|
47
|
-
###
|
56
|
+
### RGB mode (a.png X b.png)
|
48
57
|
|
49
58
|
Compare pixels by values, resulting score is a ratio of unequal pixels.
|
50
59
|
Resulting diff represents per-channel difference.
|
51
60
|
|
52
|
-
<img alt="rgb_diff.png" src="spec/fixtures/rgb_diff.png"
|
61
|
+
<img alt="rgb_diff.png" src="spec/fixtures/rgb_diff.png" />
|
53
62
|
|
54
|
-
### Grayscale mode
|
63
|
+
### Grayscale mode (a.png X a1.png)
|
55
64
|
|
56
65
|
Compare pixels as grayscale (by brightness and alpha), resulting score is a ratio of unequal pixels (with respect to provided tolerance).
|
57
66
|
|
58
67
|
Resulting diff contains grayscale version of the first image with different pixels highlighted in red and red bounding box.
|
59
68
|
|
60
|
-
<img alt="grayscale_diff.png" src="spec/fixtures/grayscale_diff.png"
|
69
|
+
<img alt="grayscale_diff.png" src="spec/fixtures/grayscale_diff.png" />
|
61
70
|
|
62
|
-
### Delta
|
71
|
+
### Delta (a.png X a1.png)
|
63
72
|
|
64
73
|
Compare pixels using [Delta E](https://en.wikipedia.org/wiki/Color_difference) distance.
|
65
74
|
Resulting diff contains grayscale version of the first image with different pixels highlighted in red (with respect to diff score).
|
66
75
|
|
67
|
-
<img alt="delta_diff.png" src="spec/fixtures/delta_diff.png"
|
76
|
+
<img alt="delta_diff.png" src="spec/fixtures/delta_diff.png" />
|
68
77
|
|
69
78
|
## Usage
|
70
79
|
|
@@ -111,19 +120,18 @@ res.match? #=> true
|
|
111
120
|
res.score #=> 0.0
|
112
121
|
```
|
113
122
|
|
114
|
-
## Excluding rectangle
|
123
|
+
## Excluding rectangle (a.png X a1.png)
|
115
124
|
|
116
|
-
<img alt="
|
117
|
-
<img alt="a1.png" src="spec/fixtures/a1.png" />
|
125
|
+
<img alt="a1.png" src="spec/fixtures/rgb_exclude_rect.png" />
|
118
126
|
|
119
127
|
You can exclude rectangle from comparing by passing `:exclude_rect` to `compare`.
|
120
128
|
E.g., if `path_1` and `path_2` contain images above
|
121
129
|
```ruby
|
122
|
-
ImageCompare.compare("path/image1.png", "path/image2.png", exclude_rect: [200, 150, 275, 200]).match? # => true
|
130
|
+
ImageCompare.compare("path/image1.png", "path/image2.png", mode: :rgb, exclude_rect: [200, 150, 275, 200]).match? # => true
|
123
131
|
|
124
132
|
# or
|
125
133
|
|
126
|
-
cmp = ImageCompare::Matcher.new exclude_rect: [200, 150, 275, 200]
|
134
|
+
cmp = ImageCompare::Matcher.new mode: :rgb, exclude_rect: [200, 150, 275, 200]
|
127
135
|
res = cmp.compare("path/image1.png", "path/image2.png")
|
128
136
|
res #=> ImageCompare::Result
|
129
137
|
res.match? #=> true
|
@@ -185,7 +193,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/instan
|
|
185
193
|
- `rake rubocop`
|
186
194
|
- `rake rubocop:md`
|
187
195
|
- `rake spec`
|
188
|
-
- `ruby examples/performance.rb` Create the gemfile.local file with the content below to run the performance tests:
|
196
|
+
- `ruby examples/performance.rb` Create the "gemfile.local" file with the content below to run the performance tests:
|
189
197
|
```ruby
|
190
198
|
# frozen_string_literal: true
|
191
199
|
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- cristianofmc
|
@@ -85,7 +85,7 @@ licenses:
|
|
85
85
|
metadata:
|
86
86
|
bug_tracker_uri: https://github.com/instantink/image_compare/issues
|
87
87
|
changelog_uri: https://github.com/instantink/image_compare/blob/master/CHANGELOG.md
|
88
|
-
documentation_uri: https://
|
88
|
+
documentation_uri: https://www.rubydoc.info/gems/image_compare/1.0.3
|
89
89
|
homepage_uri: https://github.com/instantink/image_compare
|
90
90
|
source_code_uri: https://github.com/instantink/image_compare
|
91
91
|
post_install_message:
|