Skip to content

Instantly share code, notes, and snippets.

@ngtvspc
Created January 9, 2018 23:00
Show Gist options
  • Save ngtvspc/a686dda375df122ba1a5dd8e6654532b to your computer and use it in GitHub Desktop.
Save ngtvspc/a686dda375df122ba1a5dd8e6654532b to your computer and use it in GitHub Desktop.
Remove EXIF metadata from images
# Uses the Python Imaging Library
# `pip install Pillow` works too
from PIL import Image
image_filename = "picture_with_EXIF.jpg"
image_file = open('image_filename)
image = Image.open(image_file)
# next 3 lines strip exif
image_data = list(image.getdata())
image_without_exif = Image.new(image.mode, image.size)
image_without_exif.putdata(image_data)
image_without_exif.save(u"clean_{}".format(image_filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment