Skip to content

Commit

Permalink
set w/h better
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jul 18, 2016
1 parent 75ced54 commit 301f43f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nikola/image_processing.py
Expand Up @@ -130,11 +130,16 @@ def resize_image(self, src, dst, max_size, bigger_panoramas=True, preserve_exif_

try:
im.thumbnail(size, Image.ANTIALIAS)
if exif is not None and preserve_exif_data and '0th' in exif:
if exif is not None and preserve_exif_data:
# Put right size in EXIF data
w, h = im.size
exif["0th"][piexif.ImageIFD.ImageWidth] = (w, 1)
exif["0th"][piexif.ImageIFD.ImageLength] = (h, 1)
from doit.tools import set_trace; set_trace()
if '0th' in exif:
exif["0th"][piexif.ImageIFD.ImageWidth] = w
exif["0th"][piexif.ImageIFD.ImageLength] = h
if 'Exif' in exif:
exif["Exif"][piexif.ExifIFD.PixelXDimension] = w
exif["Exif"][piexif.ExifIFD.PixelYDimension] = h
# Filter EXIF data as required
exif = self.filter_exif(exif, exif_whitelist)
im.save(dst, exif=piexif.dump(exif))
Expand Down

0 comments on commit 301f43f

Please sign in to comment.