Reading and writing an elephant

Read and write images

import numpy as np
import matplotlib.pyplot as plt

original figure

plt.figure()
img = plt.imread("../../../data/elephant.png")
plt.imshow(img)
plot elephant
<matplotlib.image.AxesImage object at 0x7f093503db50>

red channel displayed in grey

plot elephant
<matplotlib.image.AxesImage object at 0x7f0935626710>

lower resolution

plt.figure()
img_tiny = img[::6, ::6]
plt.imshow(img_tiny, interpolation="nearest")
plt.show()
plot elephant

Total running time of the script: (0 minutes 0.243 seconds)

Gallery generated by Sphinx-Gallery