code: def pad_bin_image_to_shape(image, shape):
      
      h, w = shape
      ih, iw = image.shape
      assert ih <= h
      assert iw <= w
      if iw < w:
          result = numpy.hstack((image, numpy.zeros((ih, w - iw), bool)))
      else:
          result = image
      if ih < h:
          result = numpy.vstack((result, numpy.zeros((h - ih, w), bool)))
      return result
docs: Padd image to size :shape: with zeros