Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
glitch
import random
def glitch(jpg):
f = open(jpg, 'r')
new = f.read(400)
for c in f.read():
if random.random() > random.choice([0.9992, 0.9993, 0.9994, 0.9995, 0.9996, 0.9997, 0.9998, 0.9999]):
new += chr(int(ord(c) + random.random()*random.choice(range(100)))%256)
else:
new += c
fw = open("/tmp/glitch_%s", 'w')
fw.write(new)
fw.close()
return "/tmp/glitch_%s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.