pixel_matcher 0.0.4 → 0.0.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4625b9a182bfacda310566d8369343374ebdf78aa370a8f9ce2f482f057b8464
4
- data.tar.gz: f23bc22210b46b58739c298d4858293b248e82b6e67035763d1a246a0a13ad9e
3
+ metadata.gz: 9e709cf7a1171cf3646e11ee33fdd847c90d9eb087b61bcfedaa760d7b3fbf46
4
+ data.tar.gz: 1cecb8fa4d4af025d8c0cef94f6f6598d1a8feefeb93a22fb60538705be50ff5
5
5
  SHA512:
6
- metadata.gz: '08e08719ee337d8a72d2e45cbc7926b8e5d4d658116185ee0b6b711103917fb479f7525544b968fe82b0999c14eb669a0e0b209ca78542122231f3e68a491371'
7
- data.tar.gz: 4a24ea644f3dde937b0b09ab3b2a9db99a21af3b63623c81d00d22657dccc4f46897924f331349e756f5f94cb37ceee17004f96ea3b61960f4226a10d02add5c
6
+ metadata.gz: 2322258ac93036c4e42731e2ed58fe62fbdef5bc98e2c60bcd0c27bd43025f66be3ceb05615847c3c93aa98cb19fa49933427d49a04784046ba7997b87deed2f
7
+ data.tar.gz: c9a92b95861ad934c8e0f90d0c5fbe70806ceab5c3b740a093cd820e8abf04b2b18ecfac2f3f29e7858e355b3b207a1c8d31af32b5b51d1fc911bb9ff9c055ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pixel_matcher (0.0.4)
4
+ pixel_matcher (0.0.5)
5
5
  rmagick (~> 4.0)
6
6
 
7
7
  GEM
data/bin/console CHANGED
@@ -3,12 +3,5 @@
3
3
  require "bundler/setup"
4
4
  require "pixel_matcher"
5
5
 
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
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
- store_pixels(i, j, 1, 1, [@img1.pixel_color(i, j)]) unless eq_pixel?(i, j)
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?(i, j)
54
- @img1.pixel_color(i, j) == @img2.pixel_color(i, j)
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
@@ -1,3 +1,3 @@
1
1
  module PixelMatcher
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -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
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-01 00:00:00.000000000 Z
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