def AddBorderToImage(image,
                     edge_size_px=settings.BORDER_EDGE_SIZE_PIXELS,
                     color=settings.BORDER_COLOR):
  draw = ImageDraw.Draw(image)
  width, height = image.size
  # Top across
  draw.rectangle([(0, 0), (width, edge_size_px)], fill=color)
  # Bottom across
  draw.rectangle([(0, height-edge_size_px), (width, height)], fill=color)
  # Left side
  draw.rectangle([(0, 0), (edge_size_px, height)], fill=color)
  # Right
  draw.rectangle([(width-edge_size_px, 0), (width, height)], fill=color)
  return image
Adds a border around a given image with given fill color.
dataset/ETHPy150Open GoogleCloudPlatform/solutions-orchestrator-android-sampleapp-smashpix/daemon/image_processing.py/AddBorderToImage