Skip to content

Instantly share code, notes, and snippets.

@codeincontext
Created August 16, 2013 11:02
Show Gist options
  • Save codeincontext/6249014 to your computer and use it in GitHub Desktop.
Save codeincontext/6249014 to your computer and use it in GitHub Desktop.
Glitch art generator
input_file = 'input.jpg'
output_file = 'output.jpg'
def mutate(line)
line[rand(line.length-1)] = "0"
end
File.open(input_file,'r') do |input|
File.open(output_file,'w') do |output|
while line = input.gets
mutate line if rand(10) == 0
output.puts(line)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment