Commit 2ff0cbc8 authored by Philipp Hörist's avatar Philipp Hörist

[preview] Fix bug in ratio calculation

parent 1cf978ad
...@@ -19,6 +19,7 @@ import os ...@@ -19,6 +19,7 @@ import os
import hashlib import hashlib
import binascii import binascii
import logging import logging
import math
from urllib.parse import urlparse from urllib.parse import urlparse
from io import BytesIO from io import BytesIO
import shutil import shutil
...@@ -374,11 +375,11 @@ class Base(object): ...@@ -374,11 +375,11 @@ class Base(object):
if image_width > image_height: if image_width > image_height:
if image_width > size: 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) image_width = int(size)
else: else:
if image_height > size: 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) image_height = int(size)
return image_width, image_height return image_width, image_height
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment