diff --git a/plugins/python-codecs/package-lock.json b/plugins/python-codecs/package-lock.json index 44fb4a068..3922b7b84 100644 --- a/plugins/python-codecs/package-lock.json +++ b/plugins/python-codecs/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/python-codecs", - "version": "0.1.46", + "version": "0.1.47", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@scrypted/python-codecs", - "version": "0.1.46", + "version": "0.1.47", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/python-codecs/package.json b/plugins/python-codecs/package.json index 01fae6014..68406dd71 100644 --- a/plugins/python-codecs/package.json +++ b/plugins/python-codecs/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/python-codecs", - "version": "0.1.46", + "version": "0.1.47", "description": "Python Codecs for Scrypted", "keywords": [ "scrypted", diff --git a/plugins/python-codecs/src/pilimage.py b/plugins/python-codecs/src/pilimage.py index ce5220903..9c3d11f28 100644 --- a/plugins/python-codecs/src/pilimage.py +++ b/plugins/python-codecs/src/pilimage.py @@ -35,7 +35,16 @@ class PILImage(scrypted_sdk.VideoFrame): finally: rgb.close() return await to_thread(format) - # TODO: gray... + elif options['format'] == 'gray': + def format(): + if pilImage.pilImage.mode == 'L': + return pilImage.pilImage.tobytes() + l = pilImage.pilImage.convert('L') + try: + return l.tobytes() + finally: + l.close() + return await to_thread(format) def save(): bytesArray = io.BytesIO()