Skip to content

Commit

Permalink
Merge pull request #22 from seatable/update-pillow
Browse files Browse the repository at this point in the history
update pillow
  • Loading branch information
freeplant authored Mar 8, 2024
2 parents 63016f4 + 5853b4b commit 88d3bf0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions seatable_thumbnail/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def create_image_thumbnail(self, image):

# save file
image = self.get_rotated_image(image)
image.thumbnail((self.size, self.size), Image.ANTIALIAS)
image.thumbnail((self.size, self.size), Image.Resampling.LANCZOS)
image.save(self.thumbnail_path, THUMBNAIL_EXTENSION)

# PIL to bytes
Expand All @@ -115,24 +115,24 @@ def get_rotated_image(self, image):

if orientation == 2:
# Vertical image
image = image.transpose(Image.FLIP_LEFT_RIGHT)
image = image.transpose(Image.Transpose.FLIP_LEFT_RIGHT)
elif orientation == 3:
# Rotation 180
image = image.rotate(180)
elif orientation == 4:
image = image.rotate(180).transpose(Image.FLIP_LEFT_RIGHT)
image = image.rotate(180).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
# Horizontal image
elif orientation == 5:
# Horizontal image + Rotation 90 CCW
image = image.rotate(-90,
expand=True).transpose(Image.FLIP_LEFT_RIGHT)
expand=True).transpose(Image.Transpose.FLIP_LEFT_RIGHT)
elif orientation == 6:
# Rotation 270
image = image.rotate(-90, expand=True)
elif orientation == 7:
# Horizontal image + Rotation 270
image = image.rotate(90, expand=True).transpose(
Image.FLIP_LEFT_RIGHT)
Image.Transpose.FLIP_LEFT_RIGHT)
elif orientation == 8:
# Rotation 90
image = image.rotate(90, expand=True)
Expand Down

0 comments on commit 88d3bf0

Please sign in to comment.