Skip to content

Instantly share code, notes, and snippets.

@JiggyPete
Created March 22, 2016 09:27
Show Gist options
  • Save JiggyPete/4b1d2c29dc5ceb7c13a2 to your computer and use it in GitHub Desktop.
Save JiggyPete/4b1d2c29dc5ceb7c13a2 to your computer and use it in GitHub Desktop.
# Prerequisit: ImageMagick installed
def file_exists?(filename)
`[ -f #{filename} ] && echo "Found" || echo "Not found"` == "Not found\n"
end
['landing'].each do |screengrab_file_name|
before = screengrab_file_name + '_before.png'
after = screengrab_file_name + '_after.png'
difference = screengrab_file_name + '_difference.png'
if( file_exists?(before) )
puts before + " not found"
elsif( file_exists?(after) )
puts after + " not found"
else
puts `compare -highlight-color yellow -fuzz 3% #{before} #{after} results/#{difference}`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment