mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 08:24:55 -04:00
Copy everything to backup
This commit is contained in:
parent
b77a13812c
commit
e283b555b1
5 changed files with 151 additions and 77 deletions
|
@ -51,7 +51,11 @@ class Thumbnailer(object):
|
|||
return ((max_height * self.width) // self.height, max_height)
|
||||
|
||||
def scale(self, width, height, output_type):
|
||||
"""Rescales the image to the given dimensions"""
|
||||
"""Rescales the image to the given dimensions.
|
||||
|
||||
Returns:
|
||||
BytesIO: the bytes of the encoded image ready to be written to disk
|
||||
"""
|
||||
scaled = self.image.resize((width, height), Image.ANTIALIAS)
|
||||
return self._encode_image(scaled, output_type)
|
||||
|
||||
|
@ -65,6 +69,9 @@ class Thumbnailer(object):
|
|||
Args:
|
||||
max_width: The largest possible width.
|
||||
max_height: The larget possible height.
|
||||
|
||||
Returns:
|
||||
BytesIO: the bytes of the encoded image ready to be written to disk
|
||||
"""
|
||||
if width * self.height > height * self.width:
|
||||
scaled_height = (width * self.height) // self.width
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue