Skip to content

Commit

Permalink
Make partially-filtered case work
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jul 18, 2016
1 parent 84115e6 commit 75ced54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nikola/image_processing.py
Expand Up @@ -128,15 +128,15 @@ def resize_image(self, src, dst, max_size, bigger_panoramas=True, preserve_exif_
im = ImageOps.mirror(im)
exif['0th'][piexif.ImageIFD.Orientation] = 1

# Filter EXIF data as required
exif = self.filter_exif(exif, exif_whitelist)
try:
im.thumbnail(size, Image.ANTIALIAS)
if exif is not None and preserve_exif_data and '0th' in exif:
# Put right size in EXIF data
w, h = im.size
exif["0th"][piexif.ImageIFD.XResolution] = (w, 1)
exif["0th"][piexif.ImageIFD.YResolution] = (h, 1)
exif["0th"][piexif.ImageIFD.ImageWidth] = (w, 1)
exif["0th"][piexif.ImageIFD.ImageLength] = (h, 1)
# Filter EXIF data as required
exif = self.filter_exif(exif, exif_whitelist)
im.save(dst, exif=piexif.dump(exif))
else:
im.save(dst)
Expand Down

0 comments on commit 75ced54

Please sign in to comment.