class ImageMatcher
Attributes
diff_file_name[R]
fuzz_factor[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/juxtapose/image_matcher.rb, line 3 def initialize(options={}) @fuzz_factor = options.fetch(:fuzz_factor, 0) @diff_file_name = options.fetch(:diff_file_name, './temp.png') end
Public Instance Methods
cleanup()
click to toggle source
# File lib/juxtapose/image_matcher.rb, line 15 def cleanup if File.exist?(diff_file_name) `rm #{diff_file_name}` end end
identical?(source, target)
click to toggle source
# File lib/juxtapose/image_matcher.rb, line 8 def identical?(source, target) compare_command = "compare -fuzz #{fuzz_factor}% -metric AE -dissimilarity-threshold 1 -subimage-search" out = `#{compare_command} \"#{source}\" \"#{target}\" \"#{diff_file_name}\" 2>&1` out.chomp! out.start_with?('0') end