from PIL import Image image = Image.open("herculito-ceinture.png") width, height = image.size image_rgb = image.convert("RGB") for x in range(width//2): for y in range(height): pixel1 = image_rgb.getpixel((x,y)) pixel2 = image_rgb.getpixel((x+width//2,y)) if pixel1 == pixel2: pixel = (255,255,255) else: pixel = (0,0,0) image_rgb.putpixel((x, y), pixel) image_rgb.save("herculito-ceinture_decoded.png", "png")