SYN-32 Use the ANTIALIAS resize method for thumbnailing images

pull/105/head
Mark Haines 2015-01-06 14:13:18 +00:00
parent 0529a7e2e9
commit bc2ec808f4
1 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ class Thumbnailer(object):
def scale(self, output_path, width, height, output_type): def scale(self, output_path, width, height, output_type):
"""Rescales the image to the given dimensions""" """Rescales the image to the given dimensions"""
scaled = self.image.resize((width, height), Image.BILINEAR) scaled = self.image.resize((width, height), Image.ANTIALIAS)
return self.save_image(scaled, output_type, output_path) return self.save_image(scaled, output_type, output_path)
def crop(self, output_path, width, height, output_type): def crop(self, output_path, width, height, output_type):
@ -65,7 +65,7 @@ class Thumbnailer(object):
if width * self.height > height * self.width: if width * self.height > height * self.width:
scaled_height = (width * self.height) // self.width scaled_height = (width * self.height) // self.width
scaled_image = self.image.resize( scaled_image = self.image.resize(
(width, scaled_height), Image.BILINEAR (width, scaled_height), Image.ANTIALIAS
) )
crop_top = (scaled_height - height) // 2 crop_top = (scaled_height - height) // 2
crop_bottom = height + crop_top crop_bottom = height + crop_top
@ -73,7 +73,7 @@ class Thumbnailer(object):
else: else:
scaled_width = (height * self.width) // self.height scaled_width = (height * self.width) // self.height
scaled_image = self.image.resize( scaled_image = self.image.resize(
(scaled_width, height), Image.BILINEAR (scaled_width, height), Image.ANTIALIAS
) )
crop_left = (scaled_width - width) // 2 crop_left = (scaled_width - width) // 2
crop_right = width + crop_left crop_right = width + crop_left