
Out, err = p.communicate(input=fp.read()) P = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) The code below was developed and tested on Python 3.x / Django 1.8.ĭef strip_metadata(fp): # fp is a Django UploadedFile It's fairly straightforward to do this using the well-known exiftool and integrate it into a Django web application using the standard forms framework or in a Django REST Framework serializer. In the interest of protecting users' privacy, this data should be removed before the photo is stored and shown to other users. This metadata can include camera information and settings as well as geotags that describe where a photo was taken. When working with user-generated content in the form of uploaded images, it's a good idea to strip the metadata that is often embedded in the image files.
