Skip to content

Commit

Permalink
Merge pull request #3587 from JesperDramsch/widescreen-image-thumbnails
Browse files Browse the repository at this point in the history
Aspect ratio for panoramas to >3:1, documentation
  • Loading branch information
Kwpolska committed Dec 11, 2021
2 parents 829728f + 0eb045c commit 9b65b56
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* `Hardening <https://github.com/hardening>`_
* `Hong Xu <https://www.topbug.net>`_
* `Ivan Teoh <https://github.com/ivanteoh>`_
* `Jesper Dramsch <https://github.com/jesperdramsch>`_
* `John Kristensen <https://github.com/jerrykan>`_
* `Jonathon Anderson <https://github.com/anderbubble>`_
* `Joshua Barratt <https://github.com/jbarratt>`_
Expand Down
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Bugfixes
(Issue #3535)
* Typogrify ignores ``div`` elements with ``.math`` CSS class.
(Issue #3512)
* Adjust panorama aspect ratio to 3:1 and document behaviour.

New in v8.1.3
=============
Expand Down
1 change: 1 addition & 0 deletions nikola/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ GALLERIES_DEFAULT_THUMBNAIL = None
# options, but will have to be referenced manually to be visible on the site
# (the thumbnail has ``.thumbnail`` added before the file extension by default,
# but a different naming template can be configured with IMAGE_THUMBNAIL_FORMAT).
# Panoramas (aspect ratio over 3:1) get 4x larger thumbnails due to scaling issues.

IMAGE_FOLDERS = {'images': 'images'}
# IMAGE_THUMBNAIL_SIZE = 400
Expand Down
4 changes: 2 additions & 2 deletions nikola/image_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def resize_image(self, src, dst=None, max_size=None, bigger_panoramas=True, pres
if w > max_size or h > max_size:
size = max_size, max_size
# Panoramas get larger thumbnails because they look *awful*
if bigger_panoramas and w > 2 * h:
if bigger_panoramas and w > 3 * h:
size = min(w, max_size * 4), min(w, max_size * 4)
try:
im.thumbnail(size, Image.ANTIALIAS)
Expand Down Expand Up @@ -189,7 +189,7 @@ def resize_svg(self, src, dst_paths, max_sizes, bigger_panoramas):
# calculate new size preserving aspect ratio.
ratio = float(w) / h
# Panoramas get larger thumbnails because they look *awful*
if bigger_panoramas and w > 2 * h:
if bigger_panoramas and w > 3 * h:
max_size = max_size * 4
if w > h:
w = max_size
Expand Down

0 comments on commit 9b65b56

Please sign in to comment.