def save_with_exif_info(img, *args, **kwargs):
    """Saves an image using PIL, preserving the exif information.

    Args:
        img (PIL.Image.Image):
        *args: The arguments for the `save` method of the Image class.
        **kwargs: The keywords for the `save` method of the Image class.

    """
    if 'exif' in kwargs:
        exif = kwargs.pop('exif')
    else:
        exif = img.info.get('exif')
    img.save(*args, exif=exif, **kwargs)