Use stride//4 rather than the returned image w

As per discussion on the mpv issue https://github.com/mpv-player/mpv/issues/7076 to handle the screenshot-raw when vf cropping filters are in use.
This commit is contained in:
dfaker 2019-10-20 17:34:43 +01:00 committed by jaseg
parent 7117de4005
commit 728e8b2556

2
mpv.py
View file

@ -683,7 +683,7 @@ class MPV(object):
if res['format'] != 'bgr0':
raise ValueError('Screenshot in unknown format "{}". Currently, only bgr0 is supported.'
.format(res['format']))
img = Image.frombytes('RGBA', (res['w'], res['h']), res['data'])
img = Image.frombytes('RGBA', (res['stride']//4, res['h']), res['data'])
b,g,r,a = img.split()
return Image.merge('RGB', (r,g,b))