mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-30 11:10:43 +01:00
parent
a8f53c4b03
commit
b2b790e387
@ -158,22 +158,16 @@ class FillOperation(Operation):
|
|||||||
# Crop!
|
# Crop!
|
||||||
willow.crop(int(left), int(top), int(right), int(bottom))
|
willow.crop(int(left), int(top), int(right), int(bottom))
|
||||||
|
|
||||||
# Resize the final image
|
# Get scale for resizing
|
||||||
|
# The scale should be the same for both the horizontal and
|
||||||
|
# vertical axes
|
||||||
aftercrop_width, aftercrop_height = willow.get_size()
|
aftercrop_width, aftercrop_height = willow.get_size()
|
||||||
horz_scale = self.width / aftercrop_width
|
scale = self.width / aftercrop_width
|
||||||
vert_scale = self.height / aftercrop_height
|
|
||||||
|
|
||||||
if aftercrop_width <= self.width or aftercrop_height <= self.height:
|
# Only resize if the image is too big
|
||||||
return
|
if scale < 1.0:
|
||||||
|
# Resize!
|
||||||
if horz_scale > vert_scale:
|
willow.resize(self.width, self.height)
|
||||||
width = self.width
|
|
||||||
height = int(aftercrop_height * horz_scale)
|
|
||||||
else:
|
|
||||||
width = int(aftercrop_width * vert_scale)
|
|
||||||
height = self.height
|
|
||||||
|
|
||||||
willow.resize(width, height)
|
|
||||||
|
|
||||||
def get_vary(self, image):
|
def get_vary(self, image):
|
||||||
focal_point = image.get_focal_point()
|
focal_point = image.get_focal_point()
|
||||||
|
Loading…
Reference in New Issue
Block a user