Resize image in Python without losing EXIF data
exif, image-processing, python, python-imaging-library
Solution
import jpeg
jpeg.setExif(jpeg.getExif('foo.jpg'), 'foo-resized.jpg')
http://www.emilas.com/jpeg/
Problem
I need to resize jpg images with Python without losing the original image's EXIF data (metadata about date taken, camera model etc.). All google searches about python and images point to the PIL library which I'm currently using, but doesn't seem to be able to retain the metadata. The code I have so far (using PIL) is this: ``` img = Image.open('foo.jpg') width,height = 800,600 if img.size[0] < img.size[1]: width,height = height,width resized_img = img.resize((width, height), Image.ANTIALIAS) # best down-sizing filter resized_img.save('foo-resized.jpg') ``` Any ideas? Or other libraries that I could be using?