Skip to content

Instantly share code, notes, and snippets.

@Vaguery
Created August 15, 2010 19:27
Show Gist options
  • Select an option

  • Save Vaguery/525854 to your computer and use it in GitHub Desktop.

Select an option

Save Vaguery/525854 to your computer and use it in GitHub Desktop.
# draws a random polygon (with absolute size!) of a random color and transparency
def rand_poly
"-fill \"rgba(#{rand()*100}, #{rand()*100}, #{rand()*100}, #{rand()})\" -stroke none -draw \"polyline #{rand(640)},#{rand(480)} #{rand(640)},#{rand(480)} #{rand(640)},#{rand(480)} #{rand(640)},#{rand(480)}\" "
end
# drop some random polygons onto the stupid wizard logo image
`convert logo: #{rand_poly} #{rand_poly} #{rand_poly} logo.tif`
# compare the original to the new image, and report the root mean squared error
`compare -verbose -metric RMSE logo: logo.tif logodiff.tif`
# show me both the new messy one and the result of `compare`
`open logo.tif`
`open logodiff.tif`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment