aspect for crop

This commit is contained in:
Kuroshini 2020-01-24 13:02:22 +03:00
parent a195ed3a53
commit 28718d17d1

View File

@ -98,7 +98,8 @@ 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'{round(x2 - x1)}x{round(y2 - y1)}',
'geometry': f'{round(x2 - x1)}x{round(y2 - y1)}' if 'certain_aspect' not in validated_data else
validated_data['certain_aspect'],
'quality': 100,
'cropbox': f'{x1},{y1},{x2},{y2}'
}