def add_frame(img, c, b=40):
    """Add a colored frame around an image with color c and thickness b
    """
    img = img.copy()
    img[:, :b] = img[:b, :] = img[:, -b:] = img[-b:, :] = c
    return img