diff options
author | Erik Johnston <erik@matrix.org> | 2017-10-12 17:31:24 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-10-12 17:31:24 +0100 |
commit | e283b555b1f20de4fd393fd947e82eb3c635b7e9 (patch) | |
tree | 7b5aafae42dd35d1dacc96e965d0ad813862b08a /synapse/rest/media/v1/thumbnailer.py | |
parent | Typo (diff) | |
download | synapse-e283b555b1f20de4fd393fd947e82eb3c635b7e9.tar.xz |
Copy everything to backup
Diffstat (limited to 'synapse/rest/media/v1/thumbnailer.py')
-rw-r--r-- | synapse/rest/media/v1/thumbnailer.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/rest/media/v1/thumbnailer.py b/synapse/rest/media/v1/thumbnailer.py index 60498b08aa..e1ee535b9a 100644 --- a/synapse/rest/media/v1/thumbnailer.py +++ b/synapse/rest/media/v1/thumbnailer.py @@ -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 |