diff options
author | Philipp Hörist <forenjunkie@chello.at> | 2018-05-07 21:18:27 +0300 |
---|---|---|
committer | Philipp Hörist <forenjunkie@chello.at> | 2018-05-07 23:11:22 +0300 |
commit | 2ff0cbc8367785a148b835973aed7d62c0449fca (patch) | |
tree | d471d71968649326cd338ab8a2978008b029201d /url_image_preview | |
parent | 1cf978ad226dadecf41e6b913d6284ebde7a2a2b (diff) |
[preview] Fix bug in ratio calculation
Diffstat (limited to 'url_image_preview')
-rw-r--r-- | url_image_preview/url_image_preview.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/url_image_preview/url_image_preview.py b/url_image_preview/url_image_preview.py index 30aeea0..7142ef2 100644 --- a/url_image_preview/url_image_preview.py +++ b/url_image_preview/url_image_preview.py @@ -19,6 +19,7 @@ import os import hashlib import binascii import logging +import math from urllib.parse import urlparse from io import BytesIO import shutil @@ -374,11 +375,11 @@ class Base(object): if image_width > image_height: if image_width > size: - image_height = int(size / float(image_width) * image_height) + image_height = math.ceil((size / float(image_width) * image_height)) image_width = int(size) else: if image_height > size: - image_width = int(size / float(image_height) * image_width) + image_width = math.ceil((size / float(image_height) * image_width)) image_height = int(size) return image_width, image_height |