docs: def autocrop(im, bgcolor):
      "Crop away a border of the given background color."
      if im.mode != "RGB":
          im = im.convert("RGB")
      bg = Image.new("RGB", im.size, bgcolor)
      diff = ImageChops.difference(im, bg)
      bbox = diff.getbbox()
      if bbox:
          return im.crop(bbox)
  
      return im