In [10]:
import numpy as np
import matplotlib.pyplot as pt
In [11]:
from PIL import Image
In [18]:
def load_image(name):
    with Image.open(name).resize((500,500)) as img:
        return np.sum(np.array(img), axis=-1).astype(np.float32)/(3*255)
In [19]:
andreas = load_image("andreas.jpeg")
In [25]:
# keep
pt.imshow(andreas, cmap="gray")
Out[25]:
<matplotlib.image.AxesImage at 0x7f0e9c778d68>

Let's get a little creative... (vmin and vmax as keyword arguments on imshow might be handy)

In [30]:
pt.imshow(3*andreas, cmap="gray", vmin=0, vmax=1)
Out[30]:
<matplotlib.image.AxesImage at 0x7f0e9c5b5278>

In [23]:
dicaprio = load_image("dicaprio.jpeg")

Now let's try something truly scary...

In [24]:
pt.imshow(andreas + dicaprio, cmap="gray")
Out[24]:
<matplotlib.image.AxesImage at 0x7f0e9c7a7160>
In []: