From 728e8b2556ee5fc91a504c37c020073e26862258 Mon Sep 17 00:00:00 2001 From: dfaker <35278260+dfaker@users.noreply.github.com> Date: Sun, 20 Oct 2019 17:34:43 +0100 Subject: 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. --- mpv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpv.py b/mpv.py index c64f735..413182e 100644 --- a/mpv.py +++ b/mpv.py @@ -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)) -- cgit