Skip to content

Commit 09f0ab0

Browse files
committed
Return a copy of the image data in PILHelper's _to_native_format(), not a non-owning view.
1 parent 70d983b commit 09f0ab0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/StreamDeck/ImageHelpers/PILHelper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def _to_native_format(image, image_format):
4747
image = image.transpose(Image.FLIP_TOP_BOTTOM)
4848

4949
# We want a compressed image in a given codec, convert.
50-
compressed_image = io.BytesIO()
51-
image.save(compressed_image, image_format['format'], quality=100)
52-
return compressed_image.getbuffer()
50+
with io.BytesIO() as compressed_image:
51+
image.save(compressed_image, image_format['format'], quality=100)
52+
return compressed_image.getvalue()
5353

5454

5555
def create_image(deck, background='black'):

0 commit comments

Comments
 (0)