From e0c2138ba709377c8b9f4a294d5744d3806b2c85 Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Thu, 23 Jan 2020 19:33:02 +0300 Subject: [PATCH] fix crops --- apps/gallery/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/gallery/serializers.py b/apps/gallery/serializers.py index 41e75cd7..fb5bfa26 100644 --- a/apps/gallery/serializers.py +++ b/apps/gallery/serializers.py @@ -98,7 +98,7 @@ class CropImageSerializer(ImageSerializer): x1, y1 = int(crop.split(' ')[0][:-2]), int(crop.split(' ')[1][:-2]) x2, y2 = x1 + width, y1 + height crop_params = { - 'geometry': f'{self._image.image.width}x{self._image.image.width}', + 'geometry': f'{round(x2 - x1)}x{round(y2 - y1)}', 'quality': 100, 'cropbox': f'{x1},{y1},{x2},{y2}' }