1

Is there any python library/easy way to strip EXIF data from a JPEG without a significant performance/image quality impact? I searched for one but couldn't find much. I'm hosting some user upload images and would like to strip this data for privacy/safety reasons.

Thanks

Lucifer N.
  • 908
  • 2
  • 15
  • 32

2 Answers2

1
image = GExiv2.Metadata('sample.jpg')
image.clear_exif()
image.clear_xmp()
image.save_file()

with gexiv2 library: https://wiki.gnome.org/Projects/gexiv2

RedBug
  • 154
  • 3
  • Does not work if the meta data is already too big. The error, `GLib.Error: GExiv2: Failed to read image data (14)`. – notalentgeek Jun 28 '17 at 10:52
1

Just in case anyone's looking for a existing (python) implementation or a higher-level solution with more features, here's a link to the Metadata Anonymization Toolkit.

It may be interesting to look at the images.py file, which includes useful information.

Jieter
  • 3,871
  • 1
  • 18
  • 30
loopbackbee
  • 20,255
  • 9
  • 57
  • 91