写真はパグです。
from base64 import encodestring, decodestring from random import randint mat = encodestring(open("orig.jpg", "rb").read()) gt = "".join([str(randint(0, 9)) if c == '0' and randint(0, 9) < 1 else c for c in mat]) open("glitched.jpg", "wb").write(decodestring(gt))