Python: Remove Exif info from images
from PIL import Imageimage = Image.open('image_file.jpeg')# next 3 lines strip exifdata = list(image.getdata())image_without_exif = Image.new(image.mode, image.size)image_without_exif.putdata(data)image_without_exif.save('image_file_without_exif.jpeg')
For me, gexiv2
works fine:
#!/usr/bin/python3from gi.repository import GExiv2exif = GExiv2.Metadata('8snmhp4sjd75vdr27gbadolc003i.jpg')exif.clear_exif()exif.clear_xmp()exif.save_file()
See also Exif manipulation library for python, which you linked, but didn't read all answers ;)
You don't even need to do the extra steps @user2141737 suggested. Just opening it up with PIL and saving it again seems to do the trick just fine:
from PIL import Imageimage = Image.open('path/to/image')image.save('new/path/' + file_name)