I am using PIL to enhance my images. While saving I need both the geographic coordinates and the orientation angles written to the header of the enhanced image. So far I have failed find a way to write the orientation angles.
I could write the coordinates using piexif after reading Preserve exif data of image with PIL when resize(create thumbnail). But this seems not enough to write the orientation also, or maybe I am missing something.
im = Image.open(direc + '\\' + filename)
exif_dict = piexif.load(im.info["exif"])
exif_bytes = piexif.dump(exif_dict)
enhancer = ImageEnhance.Brightness(im)
enhanced_im = enhancer.enhance(1.8)
enhanced_im.save(s + 'enhanced\\' + directory + "\e_" + filename, "JPEG", exif=exif_bytes)
When I print my exif_dict I see two main keys 0th and Exif (with reasonable key-value pairs under each of them and a lot of \x00\x00\x00q\x00\x00\x00g\x00\x00\x00r\x00\x00\x00l\x00\x00\x0... such characters which continues even after the parenthesis of the dictionary has ended. Please advise.