Skip to content

Commit

Permalink
Enable thumbnail creation for very large images
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-easterbrook committed Jul 25, 2018
1 parent 3ae05ce commit 6527aed
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/photini/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import unicode_literals

__version__ = '2018.6.0'
build = '1157 (fc0d2cd)'
__version__ = '2018.7.0'
build = '1158 (3ae05ce)'
11 changes: 9 additions & 2 deletions src/photini/imagelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,17 @@ def regenerate_thumbnail(self):
if orientation in (2, 4, 5, 7):
transform = transform.scale(-1.0, 1.0)
qt_im = qt_im.transformed(transform)
# DCF spec says thumbnail must be 160 x 120 so pad picture
# to 4:3 aspect ratio
w = qt_im.width()
h = qt_im.height()
# use Qt's scaling (not high quality) to pre-shrink very
# large images, to avoid PIL "DecompressionBombWarning"
if max(w, h) >= 6000:
qt_im = qt_im.scaled(
6000, 6000, Qt.KeepAspectRatio, Qt.SmoothTransformation)
w = qt_im.width()
h = qt_im.height()
# DCF spec says thumbnail must be 160 x 120 so pad picture
# to 4:3 aspect ratio
if w >= h:
new_h = int(0.5 + (float(w * 3) / 4.0))
new_w = int(0.5 + (float(h * 4) / 3.0))
Expand Down

0 comments on commit 6527aed

Please sign in to comment.