aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons/evergreen/snakes/utils.py
diff options
context:
space:
mode:
authorGravatar sco1 <[email protected]>2019-05-30 11:45:44 -0400
committerGravatar sco1 <[email protected]>2019-05-30 11:45:44 -0400
commit47b1f344b59f9194f1753b2118810c852507d3ce (patch)
tree88258e0b987f9bc31bef53f5afcf90074eb4233b /bot/seasons/evergreen/snakes/utils.py
parentUpdate pre-commit config so actually it uses the flake8 plugins (diff)
Fix snake draw command
Change frame to bytes helper to return the BytesIO object rather than the full content of the buffer. Update variables & add an output type hint to reinforce the change to the helper's output.
Diffstat (limited to 'bot/seasons/evergreen/snakes/utils.py')
-rw-r--r--bot/seasons/evergreen/snakes/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/bot/seasons/evergreen/snakes/utils.py b/bot/seasons/evergreen/snakes/utils.py
index 4899c2a2..3754a122 100644
--- a/bot/seasons/evergreen/snakes/utils.py
+++ b/bot/seasons/evergreen/snakes/utils.py
@@ -352,11 +352,12 @@ def create_snek_frame(
return image
-def frame_to_png_bytes(image: Image):
+def frame_to_png_bytes(image: Image) -> io.BytesIO:
"""Convert image to byte stream."""
stream = io.BytesIO()
image.save(stream, format='PNG')
- return stream.getvalue()
+ stream.seek(0)
+ return stream
log = logging.getLogger(__name__)