code: """
  Image manipulation and numpy arrays
  ====================================
  
  This example shows how to do image manipulation using common numpy arrays
  tricks.
  
  """
  
  import numpy as np
  import scipy
  import scipy.misc
  import matplotlib.pyplot as plt
  
  face = scipy.misc.face(gray=True)
  face[10:13, 20:23]
  face[100:120] = 255
  
  lx, ly = face.shape
  X, Y = np.ogrid[0:lx, 0:ly]
  mask = (X - lx/2)**2 + (Y - ly/2)**2 > lx*ly/4
  face[mask] = 0
  face[range(400), range(400)] = 255
  
  plt.figure(figsize=(3, 3))
  plt.axes([0, 0, 1, 1])
  plt.imshow(face, cmap=plt.cm.gray)
  plt.axis('off')
  
  plt.show()
   """
  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)
  
  #################################
  # red channel displayed in grey
  #################################
  
  plt.figure()
  img_red = img[:, :, 0]
  plt.imshow(img_red, cmap=plt.cm.gray)
  
  #################################
  # lower resolution
  #################################
  
  plt.figure()
  img_tiny = img[::6, ::6]
  plt.imshow(img_tiny, interpolation='nearest') 
  
  plt.show()
  
apis: scipy.misc.face matplotlib.pyplot.figure matplotlib.pyplot.axis matplotlib.pyplot.axes matplotlib.pyplot.imshow matplotlib.pyplot.show
apis: matplotlib.pyplot.imread matplotlib.pyplot.figure matplotlib.pyplot.imshow matplotlib.pyplot.show