code: def resize(self, shape):
          
          if self.is_empty():
              raise ValueError("Cannot resize an empty image")
  
          factor = [1, 1]
          zoom = [True, True]
          zoom[0] = shape[0] >= self.height
          zoom[1] = shape[1] >= self.width
  
          if zoom[0]:
              factor[0] = shape[0] * 1.0 / self.height
          else:
              factor[0] = self.height * 1.0 / shape[0]
          if zoom[1]:
              factor[1] = shape[1] * 1.0 / self.width
          else:
              factor[1] = self.width * 1.0 / shape[1]
  
          if(int(factor[0]) != factor[0] or
             int(factor[1]) != factor[1]):
              raise ValueError("Resize not of integer factor!")
  
          factor[0] = int(factor[0])
          factor[1] = int(factor[1])
  
          i = 0
          for chn in self.channels:
              if zoom[0]:
                  chn = chn.repeat([factor[0]] * chn.shape[0], axis=0)
              else:
                  chn = chn[[idx * factor[0]
                             for idx in range(int(self.height / factor[0]))],
                            :]
              if zoom[1]:
                  self.channels[i] = chn.repeat([factor[1]] * chn.shape[1],
                                                axis=1)
              else:
                  self.channels[i] = chn[:,
                                         [idx * factor[1]
                                          for idx in range(int(self.width /
                                                               factor[1]))]]
  
              i = i + 1
  
          self.height = self.channels[0].shape[0]
          self.width = self.channels[0].shape[1]
          self.shape = self.channels[0].shape
docs: Resize the image to the given *shape* tuple, in place. For zooming,
          nearest neighbour method is used, while for shrinking, decimation is
          used. Therefore, *shape* must be a multiple or a divisor of the image
          shape.