def _update_exif_orientation(exif, orientation):
 exif_dict = piexif.load(exif)
 if orientation:
  exif_dict['0th'][piexif.ImageIFD.Orientation] = orientation
 return piexif.dump(exif_dict)

def _update_exif_orientation ( exif , orientation ) : exif_dict = piexif . load ( exif ) if orientation : exif_dict [ '0th' ] [ piexif . ImageIFD . Orientation ] = orientation return piexif . dump ( exif_dict )
given an exif value and an integer value 1-8 .