diff --git a/plugins/python-codecs/package-lock.json b/plugins/python-codecs/package-lock.json index 2f5136aba..dc1f21071 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.91", + "version": "0.1.92", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@scrypted/python-codecs", - "version": "0.1.91", + "version": "0.1.92", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/python-codecs/package.json b/plugins/python-codecs/package.json index a7c8938b1..0b1fd2ee8 100644 --- a/plugins/python-codecs/package.json +++ b/plugins/python-codecs/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/python-codecs", - "version": "0.1.91", + "version": "0.1.92", "description": "Python Codecs for Scrypted", "keywords": [ "scrypted", diff --git a/plugins/python-codecs/src/vipsimage.py b/plugins/python-codecs/src/vipsimage.py index ce8018417..2ce53476a 100644 --- a/plugins/python-codecs/src/vipsimage.py +++ b/plugins/python-codecs/src/vipsimage.py @@ -110,3 +110,9 @@ class ImageReader(scrypted_sdk.ScryptedDeviceBase, scrypted_sdk.BufferConverter) async def convert(self, data: Any, fromMimeType: str, toMimeType: str, options: scrypted_sdk.MediaObjectOptions = None) -> Any: vips = Image.new_from_buffer(data, '') return await createImageMediaObject(VipsImage(vips)) + +def new_from_memory(data, width: int, height: int, bands: int): + return Image.new_from_memory(data, width, height, bands, pyvips.BandFormat.UCHAR) + +def new_from_buffer(data, width: int, height: int, bands: int): + return Image.new_from_buffer(data, width, height, bands, pyvips.BandFormat.UCHAR)