pilhoon / wiki_public

0 stars 0 forks source link

PIL Image #12

Open pilhoon opened 4 years ago

pilhoon commented 4 years ago

exif_transpose

exif = image.getexif()
# Remove all exif tags
for k in exif.keys():
    if k != 0x0112:
        exif[k] = None # If I don't set it to None first (or print it) the del fails for some reason. 
        del exif[k]
# Put the new exif object in the original image
new_exif = exif.tobytes()
image.info["exif"] = new_exif
# Rotate the image
transposed = ImageOps.exif_transpose(image)

#