May-26-2020, 02:27 AM
I need help reversing the order of pixels in an image after every row. If anyone has a solution it would be appreciated.
def main(): from PIL import Image x = 32 y = 12 im = Image.open('animation1/masktest1.bmp') rgb_im = im.convert('RGB') im2 = Image.new( 'RGB', (32,12), "black") pixels = im2.load() for j in range(y): for i in range(x): if(j % 2 == 0): r, g, b = rgb_im.getpixel((i, j)) pixels[i,j] = (r, g, b) else: for o in range(0, x, -1): r, g, b = rgb_im.getpixel((i, j)) pixels[o, j] = (r, g, b) im2.save("animation1/masktest2.bmp") main()