Convert an image to given format.

def convert_image(from_file, to_file, image_format):
    """Convert an image to given format."""
    with Image(filename=from_file) as original:
        with original.convert(image_format) as converted:
            converted.save(filename=to_file)
    return to_file