Created
November 1, 2017 00:36
-
-
Save ShakataGaNai/a9620ff0a9610e2a2d61813872134db3 to your computer and use it in GitHub Desktop.
Load every JPG file in the current directory and strip all the exif from it.
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
from PIL import Image | |
import re | |
from os import listdir | |
from os.path import isfile, join | |
def clean(f): | |
image_file = open(f) | |
image = Image.open(image_file) | |
data = list(image.getdata()) | |
image_without_exif = Image.new(image.mode, image.size) | |
image_without_exif.putdata(data) | |
image_without_exif.save(f) | |
onlyfiles = [f for f in listdir('./') if isfile(join('./', f))] | |
for file in onlyfiles: | |
if file.endswith(".jpg"): | |
print(file) | |
clean(file) | |
print("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment