summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordfaker <35278260+dfaker@users.noreply.github.com>2019-10-20 17:34:43 +0100
committerjaseg <githubaccount@jaseg.net>2019-11-10 16:11:22 +0100
commit728e8b2556ee5fc91a504c37c020073e26862258 (patch)
tree3cba7e7ce8576aec669b5a09148d150ab4589e41
parent7117de4005cc470a45efd9cf2e9657bdf63a9079 (diff)
downloadpython-mpv-728e8b2556ee5fc91a504c37c020073e26862258.tar.gz
python-mpv-728e8b2556ee5fc91a504c37c020073e26862258.tar.bz2
python-mpv-728e8b2556ee5fc91a504c37c020073e26862258.zip
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.
-rw-r--r--mpv.py2
1 files changed, 1 insertions, 1 deletions
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))