mirror of
https://github.com/koush/scrypted.git
synced 2026-09-18 09:40:44 +01:00
python-codecs: fix gray conversion
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user