Skip to content
Permalink
Browse files
set w/h better
  • Loading branch information
ralsina committed Jul 18, 2016
1 parent 75ced54 commit 301f43fbf1329abe64e9a15b3149242af5c12963
Showing with 8 additions and 3 deletions.
  1. +8 −3 nikola/image_processing.py
@@ -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))

0 comments on commit 301f43f

Please sign in to comment.