I want to create a small image with PIL, my idea is first creating an ndarray object with numpy, then transforming it into a Image object, but it doesn't work!
small = np.array([[0, 1, 1, 0, 1, 0],
[0, 1, 1, 0, 1, 0]])
small = Image.fromarray(small, 'L')
print(small.size)
these codes print (6, 2), so why it transposes my original input? What made my even more confused is that when I try to print all the pixels:
for i in range(6):
for j in range(2):
print(small.getpixel((i, j)), end='')
it prints out : 0 0 0 0 0 1 0 0 0 0 0 0 I had no idea about what have happened ........