May 27, 2009
3:19 p.m.
2009/5/27 cp <lubensch.proletariat.inc@gmail.com>:
img=Image.open('something.tif') img.size (1900,1600)
then
arr=asarray(img) arr.shape (1600,1900,3)
This means that the array-image has 1600 color channels, 1900 image pixel rows and 3 image pixel columns. Why is that?
No, it means that you have 1600 rows, 1900 columns and 3 colour channels.
if I reshape with
arr.reshape(3,1900,1600)
will there be a mix-up in pixel values and coordinates when compared to the initial PIL image?
You'll have to use np.rollaxis(img, -1) to get the shape you want. Regards Stéfan