Class: Pixage::Compare
- Inherits:
-
Object
- Object
- Pixage::Compare
- Defined in:
- lib/pixage/images/compare.rb
Instance Method Summary collapse
Instance Method Details
#compare_images(images, options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pixage/images/compare.rb', line 12 def compare_images(images,) convert = Convert.new() if convert.check_sizes(images) console_log("Warning: Image sizes are not equal, the generated diff might be misleading, please use : ", :warning) console_log("pixage resize_n_compare\n", :pass) end execution_dir = Time.now.strftime("%d-%b-%y-%H-%M-%S") create_compare_execution_dir(execution_dir) cmd = "compare -dissimilarity-threshold #{[:threshold]} -fuzz #{[:fuzz]} -metric AE -highlight-color #{[:color]} #{images[:expected]} #{images[:actual]} pixage_report/#{execution_dir}/diff.png" execute_command(cmd) Pathname.new("pixage_report/#{execution_dir}/diff.png").realpath.to_s end |
#resize_n_compare_images(images, options) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/pixage/images/compare.rb', line 25 def resize_n_compare_images(images,) convert = Convert.new() execution_dir = Time.now.strftime("%d-%b-%y-%H-%M-%S") create_compare_execution_dir(execution_dir) images = make_copies(images, "pixage_report/#{execution_dir}") convert.resize_images(images,) cmd = "compare -dissimilarity-threshold #{[:threshold]} -fuzz #{[:fuzz]} -metric AE -highlight-color #{[:color]} #{images[:expected]} #{images[:actual]} pixage_report/#{execution_dir}/diff.png" execute_command(cmd) Pathname.new("pixage_report/#{execution_dir}/diff.png").realpath.to_s end |