class DotDiff::Image::Container
Attributes
baseimg_file[R]
newimg_file[R]
Public Class Methods
new(baseimg_file, newimg_file)
click to toggle source
# File lib/dotdiff/image/container.rb, line 6 def initialize(baseimg_file, newimg_file) @baseimg_file = baseimg_file @newimg_file = newimg_file end
Public Instance Methods
both_images_same_dimensions?()
click to toggle source
# File lib/dotdiff/image/container.rb, line 11 def both_images_same_dimensions? base_image.rows == new_image.rows && base_image.columns == new_image.columns end
dimensions_mismatch_msg()
click to toggle source
# File lib/dotdiff/image/container.rb, line 20 def dimensions_mismatch_msg <<~MSG Images are not the same dimensions to be compared Base file: #{base_image.columns}x#{base_image.rows} New file: #{new_image.columns}x#{new_image.rows} MSG end
total_pixels()
click to toggle source
# File lib/dotdiff/image/container.rb, line 16 def total_pixels base_image.rows * base_image.columns end
Private Instance Methods
base_image()
click to toggle source
# File lib/dotdiff/image/container.rb, line 32 def base_image @base_image ||= Magick::Image.read(baseimg_file).first end
new_image()
click to toggle source
# File lib/dotdiff/image/container.rb, line 36 def new_image @new_image ||= Magick::Image.read(newimg_file).first end