In [1]:
%pylab inline
import numpy as np
from PIL import Image
Using PIL's Image function, and convert to nparray:
In [14]:
im = Image.open('MODICE.v0.4.h23v05.2001.3strike.landice.tif')
imarray = np.array(im)
print imarray.shape
print type( imarray )
Or use pyplot (which apparently uses PIL under-the-hood
In [7]:
import matplotlib.pyplot as plt
I = plt.imread('MODICE.v0.4.h23v05.2001.3strike.landice.tif')
In [8]:
type(I)
Out[8]:
In [9]:
diff = I - imarray
In [11]:
plt.imshow(imarray)
plt.gray()
plt.show()
In [ ]: