[preview] Fix bug in ratio calculation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user