I have the image and a list of blue pixels. I want to iterate over the blue pixels, change them to red color and make gif from that. So it must be a line that consequently changing color from blue to red, but something going wrong
im = Image.open(r"test2.png")
pixels = im.load()
images = []
blues = get_sorted_blues() # See func below
for x, y in blues:
...: pixels[x, y] = (255, 0, 0)
...: images.append(im)
images[0].save('result.gif',
...: save_all=True,
...: append_images=images[1:],
...: duration=100,
...: loop=0)
def get_sorted_blues():
...: blues = []
...: for x in range(im.width):
...: for y in range(im.height):
...: if pixels[x, y] == (0, 0, 255):
...: blues.append([x, y])
...: return sorted(blues)
result.gif it is just a red line, without any animation

