code: def imresize(self, data, new_wd, new_ht, method='bilinear'):
          
          old_ht, old_wd = data.shape[:2]
          start_time = time.time()
  
          if have_pilutil:
              means = 'PIL'
              zoom_x = float(new_wd) / float(old_wd)
              zoom_y = float(new_ht) / float(old_ht)
              if (old_wd >= new_wd) or (old_ht >= new_ht):
                  # data size is bigger, skip pixels
                  zoom = max(zoom_x, zoom_y)
              else:
                  zoom = min(zoom_x, zoom_y)
  
              newdata = imresize(data, zoom, interp=method)
  
          else:
              raise ImageError("No way to scale image smoothly")
  
          end_time = time.time()
          self.logger.debug("scaling (%s) time %.4f sec" % (
              means, end_time - start_time))
  
          return newdata
docs: Scale an image in numpy array _data_ to the specified width and
          height.  A smooth scaling is preferred.