pixel_matcher 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/console +2 -9
- data/exe/pixel_matcher +14 -0
- data/lib/pixel_matcher/diff_image.rb +5 -3
- data/lib/pixel_matcher/version.rb +1 -1
- data/pixel_matcher.gemspec +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e709cf7a1171cf3646e11ee33fdd847c90d9eb087b61bcfedaa760d7b3fbf46
|
4
|
+
data.tar.gz: 1cecb8fa4d4af025d8c0cef94f6f6598d1a8feefeb93a22fb60538705be50ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2322258ac93036c4e42731e2ed58fe62fbdef5bc98e2c60bcd0c27bd43025f66be3ceb05615847c3c93aa98cb19fa49933427d49a04784046ba7997b87deed2f
|
7
|
+
data.tar.gz: c9a92b95861ad934c8e0f90d0c5fbe70806ceab5c3b740a093cd820e8abf04b2b18ecfac2f3f29e7858e355b3b207a1c8d31af32b5b51d1fc911bb9ff9c055ed
|
data/Gemfile.lock
CHANGED
data/bin/console
CHANGED
@@ -3,12 +3,5 @@
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "pixel_matcher"
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
6
|
+
require "pry"
|
7
|
+
Pry.start
|
data/exe/pixel_matcher
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "pixel_matcher"
|
4
|
+
|
5
|
+
raise ArgumentError, 'Specify two image paths and one output path' unless ARGV.length == 3
|
6
|
+
|
7
|
+
path1 = ARGV[0]
|
8
|
+
path2 = ARGV[1]
|
9
|
+
output_path = ARGV[2]
|
10
|
+
|
11
|
+
diff = PixelMatcher::DiffImage.from_path(path1, path2)
|
12
|
+
diff.export_diff(output_path)
|
13
|
+
|
14
|
+
puts "Generated diff image : #{output_path}"
|
@@ -45,13 +45,15 @@ module PixelMatcher
|
|
45
45
|
def store_diff
|
46
46
|
@img1.columns.times do |i|
|
47
47
|
@img1.rows.times do |j|
|
48
|
-
|
48
|
+
next if eq_pixel?(i, j)
|
49
|
+
|
50
|
+
store_pixels(i, j, 1, 1, [@img1.pixel_color(i, j)])
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
|
-
def eq_pixel?(
|
54
|
-
@img1.pixel_color(
|
55
|
+
def eq_pixel?(column, row)
|
56
|
+
@img1.pixel_color(column, row) == @img2.pixel_color(column, row)
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
data/pixel_matcher.gemspec
CHANGED
@@ -7,6 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = PixelMatcher::VERSION
|
8
8
|
spec.authors = ["ksk001100"]
|
9
9
|
spec.email = ["hm.pudding0715@gmail.com"]
|
10
|
+
spec.executables << 'pixel_matcher'
|
10
11
|
|
11
12
|
spec.summary = %q{Library to compare images and generate difference image files}
|
12
13
|
spec.description = %q{Library to compare images and generate difference image files}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixel_matcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksk001100
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|
@@ -97,7 +97,8 @@ dependencies:
|
|
97
97
|
description: Library to compare images and generate difference image files
|
98
98
|
email:
|
99
99
|
- hm.pudding0715@gmail.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- pixel_matcher
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
@@ -112,6 +113,7 @@ files:
|
|
112
113
|
- Rakefile
|
113
114
|
- bin/console
|
114
115
|
- bin/setup
|
116
|
+
- exe/pixel_matcher
|
115
117
|
- images/screen_shot.jpeg
|
116
118
|
- lib/pixel_matcher.rb
|
117
119
|
- lib/pixel_matcher/diff_image.rb
|