Skip to content

Commit

Permalink
python-codecs: pil crop is not thread safe python-pillow/Pillow#4848
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 29, 2023
1 parent 65c4a30 commit 0bff96a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/python-codecs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/python-codecs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/python-codecs",
"version": "0.1.22",
"version": "0.1.25",
"description": "Python Codecs for Scrypted",
"keywords": [
"scrypted",
Expand Down
3 changes: 2 additions & 1 deletion plugins/python-codecs/src/pilimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def format():
elif options['format'] == 'rgb':
def format():
rgbx = pilImage.pilImage
if rgbx.format != 'RGBA':
if rgbx.mode != 'RGBA':
return rgbx.tobytes()
rgb = rgbx.convert('RGB')
try:
Expand Down Expand Up @@ -96,6 +96,7 @@ def __init__(self, nativeId: str):

async def convert(self, data: Any, fromMimeType: str, toMimeType: str, options: scrypted_sdk.MediaObjectOptions = None) -> Any:
pil = Image.open(io.BytesIO(data))
pil.load()
return await createPILMediaObject(PILImage(pil))

class ImageWriter(scrypted_sdk.ScryptedDeviceBase, scrypted_sdk.BufferConverter):
Expand Down

0 comments on commit 0bff96a

Please sign in to comment.