from PIL import Image

a = 53911
b = 15677

image = Image.open("maraudeur_cr.png")

width, height = image.size
res = Image.new(image.mode, (width, height))

n = width * height

for pos in range(n):
    new_pos = (a*pos+b)%n
    pixel = image.getpixel((new_pos%width,new_pos//width))
    res.putpixel((pos%width,pos//width), pixel)

#res.save("maraudeur_cr_res.png")
res.show()
