In [39]:
from PIL import Image
from glob import glob

In [44]:
files = sorted(glob('data/*'))

In [53]:
f = files[-5]
x = Image.open(f)
print f


data/snap_2014.02.28_06.37.22.jpg

In [54]:
imshow(x)


Out[54]:
<matplotlib.image.AxesImage at 0x366c930>

In [49]:
fig = figure(figsize=(16,6))
for i,im in enumerate(x.split(),1):
    subplot(1,3,i)
    im = imshow(im, vmin=0, vmax=np.max(x)*0.5)
    if i == 3:
        cax = pylab.axes([0.05,0.1,0.1,0.015])
        cb = pylab.colorbar(im, cax=cax, orientation='horizontal')
        cb.set_ticks([0, np.max(x)*0.25, np.max(x)*0.5])


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-49-3a43fec6a28d> in <module>()
      1 fig = figure(figsize=(16,6))
----> 2 for i,im in enumerate(x.split(),1):
      3     subplot(1,3,i)
      4     im = imshow(im, vmin=0, vmax=np.max(x)*0.5)
      5     if i == 3:

/usr/local/lib/python2.7/dist-packages/PIL/Image.pyc in split(self)
   1495         "Split image into bands"
   1496 
-> 1497         if self.im.bands == 1:
   1498             ims = [self.copy()]
   1499         else:

AttributeError: 'NoneType' object has no attribute 'bands'
<matplotlib.figure.Figure at 0x2b48930>

In [ ]: