code: def image_neighbor_smooth(xlevel=0.2, ylevel=0.2, image="auto"):
      
      if image == "auto": image = _pylab.gca().images[0]
  
      Z = _n.array(image.get_array())
  
      # store this image in the undo list
      global image_undo_list
      image_undo_list.append([image, Z])
      if len(image_undo_list) > 10: image_undo_list.pop(0)
  
      # get the diagonal smoothing level (eliptical, and scaled down by distance)
      dlevel = ((xlevel**2+ylevel**2)/2.0)**(0.5)
  
      # don't touch the first column
      new_Z = [Z[0]*1.0]
  
      for m in range(1,len(Z)-1):
          new_Z.append(Z[m]*1.0)
          for n in range(1,len(Z[0])-1):
              new_Z[-1][n] = (Z[m,n] + xlevel*(Z[m+1,n]+Z[m-1,n]) + ylevel*(Z[m,n+1]+Z[m,n-1])   \
                                     + dlevel*(Z[m+1,n+1]+Z[m-1,n+1]+Z[m+1,n-1]+Z[m-1,n-1])   )  \
                                     / (1.0+xlevel*2+ylevel*2 + dlevel*4)
  
      # don't touch the last column
      new_Z.append(Z[-1]*1.0)
  
      # images have transposed data
      image.set_array(_n.array(new_Z))
  
      # update the plot
      _pylab.draw()
docs: This will bleed nearest neighbor pixels into each other with
      the specified weight factors.