diff options
author | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-01-02 14:46:19 (GMT) |
---|---|---|
committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2009-01-02 14:46:19 (GMT) |
commit | 63b74feb518820f18279b4bfc680bfb9887735c7 (patch) | |
tree | c3df8386d7f9eca2bfc811380878387cf9a976fd /Lib/plat-mac | |
parent | 0238497e931f439ff4e1ebe268f31ce23c15407f (diff) | |
download | cpython-63b74feb518820f18279b4bfc680bfb9887735c7.zip cpython-63b74feb518820f18279b4bfc680bfb9887735c7.tar.gz cpython-63b74feb518820f18279b4bfc680bfb9887735c7.tar.bz2 |
Fix for issue 900949
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r-- | Lib/plat-mac/videoreader.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Lib/plat-mac/videoreader.py b/Lib/plat-mac/videoreader.py index fbb37e1..28b71ff 100644 --- a/Lib/plat-mac/videoreader.py +++ b/Lib/plat-mac/videoreader.py @@ -238,12 +238,12 @@ class _Reader: width = self.videodescr['width'] height = self.videodescr['height'] start = 0 - rv = '' + rv = [] for i in range(height): nextline = Qdoffs.GetPixMapBytes(self.pixmap, start, width*4) start = start + rowbytes - rv = rv + nextline - return rv + rv.append(nextline) + return ''.join(rv) def reader(url): try: @@ -255,9 +255,9 @@ def reader(url): def _test(): import EasyDialogs try: - import img + from PIL import Image except ImportError: - img = None + Image = None import MacOS Qt.EnterMovies() path = EasyDialogs.AskFileForOpen(message='Video to convert') @@ -277,13 +277,11 @@ def _test(): fname = 'frame%04.4d.jpg'%num num = num+1 pname = os.path.join(dstdir, fname) - if not img: print 'Not', + if not Image: print 'Not', print 'Writing %s, size %dx%d, %d bytes'%(fname, imgw, imgh, len(data)) - if img: - wrt = img.writer(imgfmt, pname) - wrt.width = imgw - wrt.height = imgh - wrt.write(data) + if Image: + img = Image.fromstring("RGBA", (imgw, imgh), data) + img.save(pname, 'JPEG') timestamp, data = rdr.ReadVideo() MacOS.SetCreatorAndType(pname, 'ogle', 'JPEG') if num > 20: |