def save_image(img, fname):
    """Save an image.

    Parameters
    ----------
    img : `PIL.Image`
        Image to save.
    fname : `str`
        File path.
    """
    _, ext = os.path.splitext(fname)
    ext = ext[1:] or 'png'
    with open(fname, 'wb') as fp:
        img.save(fp, ext)