Update CSS and JavaScript to match preview ratio (3/2).

- Changed thumbnail resampling method to `BOX` when downscaling preview.
This commit is contained in:
Christian Bastian
2024-07-19 23:56:49 -04:00
parent 823903a38f
commit 6c08255555
2 changed files with 7 additions and 3 deletions

View File

@@ -385,7 +385,11 @@ async def get_model_preview(request):
crop_box = (0, y0, w0, y0 + int(crop_height_fp))
image = image.crop(crop_box)
image.thumbnail((w, h))
if w < w0 and h < h0:
resampling_method = Image.Resampling.BOX
else:
resampling_method = Image.Resampling.BICUBIC
image.thumbnail((w, h), resample=resampling_method)
if not image_format_is_equal(image_format, response_image_format) and (response_image_format == 'JPEG' or response_image_format == 'JPG'):
image = image.convert('RGB')