Opened 10 years ago
Closed 10 years ago
#5375 closed defect (fixed)
Video thumbnailer relies on function that has been removed from recent PIL
| Reported by: | ayleph | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | |
| Component: | programming | Keywords: | video, thumbnail, PIL, pillow |
| Cc: | Boris Bobrov | Parent Tickets: |
Description
A few users have come into IRC to report that their installations fail to process videos with the following error.
File '/srv/mediagoblin.example.org/mediagoblin/mediagoblin/media_types/video/processing.py', line 396 in process self.generate_thumb(thumb_size=thumb_size) File '/srv/mediagoblin.example.org/mediagoblin/mediagoblin/media_types/video/processing.py', line 319 in generate_thumb thumb_size[0]) File '/srv/mediagoblin.example.org/mediagoblin/mediagoblin/media_types/video/transcoders.py', line 136 in capture_thumb buffer.extract_dup(0, buffer.get_size())) File '/usr/lib/python2.7/dist-packages/PIL/Image.py', line 2053 in fromstring "Please call frombytes() instead.") Exception: fromstring() has been removed. Please call frombytes() instead.
Change History (3)
comment:1 by , 10 years ago
| Cc: | added |
|---|---|
| Status: | new → review |
comment:3 by , 10 years ago
| Priority: | major → critical |
|---|---|
| Resolution: | → fixed |
| Status: | review → closed |
Note:
See TracTickets
for help on using tickets.

The change below appears to address this issue. It works on my instance using Pillow==2.5.3 (old), Pillow==2.7.0 (recent), and Pillow==3.0.0 (current as of this post), so I think it's safe to apply. Without the change below, video files fail to process with Pillow=3.0.0 with the same error described in this issue.
CCing breton and requesting review.
From f30cfd5963a066ae6e05e22a7353ba1e5bac42f4 Mon Sep 17 00:00:00 2001 From: ayleph <ayleph@thisshitistemp.com> Date: Thu, 17 Dec 2015 21:06:42 -0500 Subject: [PATCH] Fix Issue 5375 Deprecated function in video thumb This patch fixes issue 5375 by replacing a function call that has been removed in recent versions of PIL with the recommended replacement. --- mediagoblin/media_types/video/transcoders.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediagoblin/media_types/video/transcoders.py b/mediagoblin/media_types/video/transcoders.py index 57912c5..f802049 100644 --- a/mediagoblin/media_types/video/transcoders.py +++ b/mediagoblin/media_types/video/transcoders.py @@ -132,7 +132,7 @@ def capture_thumb(video_path, dest_path, width=None, height=None, percent=0.5): buffer = sample.get_buffer() # get the image from the buffer and save it to disk - im = Image.fromstring('RGB', (width, height), + im = Image.frombytes('RGB', (width, height), buffer.extract_dup(0, buffer.get_size())) im.save(dest_path) _log.info('thumbnail saved to {0}'.format(dest_path)) -- 2.6.4