import os, sys
from PIL import Image
im = Image.open("result_bw.png")
l = []
print im.size
pix = im.load()
for x in range(im.size[0]):
for y in range(im.size[1]):
l.append(pix[x,y])
img = Image.new('L', (im.size[1],im.size[0] ))
img.putdata(l)
img.save('image.png')
The above code reads a black and white image and stores the pixel value in a list.
When I am creating a new image from the pixels stored in the list, I get the original image which is rotated anti-clockwise.
Why am I getting a rotated image?
How can I correct it?