Use of deprecated frombytes when processing videos causes the task to fail
authorChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 22 May 2015 19:16:45 +0000 (14:16 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Fri, 22 May 2015 19:16:45 +0000 (14:16 -0500)
(Anonymous contribution, not by me)

  When transcoding a video using a recent version of PIL transcoding a
  video fails reproducible. The reason for this is an AttributeError:
  'module' object has no attribute 'frombytes'gets raised, while a
  thumbnails is being created. This is because frombytes alias was
  deprecated in favor of fromstring.

mediagoblin/media_types/video/transcoders.py

index ba469af2e80cb4f145727637494ed5930d2db958..6e0b702b74fa15764b85c5689ac78b8a09cb3376 100644 (file)
@@ -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.frombytes('RGB', (width, height),
+    im = Image.fromstring('RGB', (width, height),
                          buffer.extract_dup(0, buffer.get_size()))
     im.save(dest_path)
     _log.info('thumbnail saved to {0}'.format(dest_path))