Created
January 9, 2018 23:00
-
-
Save ngtvspc/a686dda375df122ba1a5dd8e6654532b to your computer and use it in GitHub Desktop.
Remove EXIF metadata from images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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