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:
parent
7117de4005
commit
728e8b2556
1 changed files with 1 additions and 1 deletions
2
mpv.py
2
mpv.py
|
|
@ -683,7 +683,7 @@ class MPV(object):
|
||||||
if res['format'] != 'bgr0':
|
if res['format'] != 'bgr0':
|
||||||
raise ValueError('Screenshot in unknown format "{}". Currently, only bgr0 is supported.'
|
raise ValueError('Screenshot in unknown format "{}". Currently, only bgr0 is supported.'
|
||||||
.format(res['format']))
|
.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()
|
b,g,r,a = img.split()
|
||||||
return Image.merge('RGB', (r,g,b))
|
return Image.merge('RGB', (r,g,b))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue