Created
April 11, 2012 16:15
-
-
Save tijmenb/2360303 to your computer and use it in GitHub Desktop.
Compare a bunch of images to find duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| files = Dir.glob("*.png") | |
| compares = {} | |
| files.each do |file| | |
| files.each do |compare_to| | |
| key = [file, compare_to].sort.join("-") | |
| unless compares[key] || file == compare_to | |
| compares[key] = `compare -metric MAE #{file} #{compare_to} null: 2>&1` | |
| puts "#{file} vs #{compare_to} = " + compares[key] # if a comparison yields `0 (0)`, they're the same | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment