I need to compare parts/sections of two images using RMagick (Ruby binding for ImageMagick). Has anyone had anything to do with it.
I am using compare_channel
method to generate the image! I have read up the RMagick docs and the RMagick examples from the docs and I get the feeling that I could use
mask
somehow, but not sure how?
Any ideas?
Comparing the results of Image#export_pixels_to_string should do the trick:
area1_str = image1.export_pixels_to_string(xpos, ypos, width, height)
area2_str = image2.export_pixels_to_string(xpos, ypos, width, height)
if area1_str == area2_str
puts "Equal"
else
puts "Different"
end