flavioribeiro/video-thumbnail-generator

Recent PIL throws error if RGBA is not supported

Closed this issue · 2 comments

The result sprite is saved in RGBA mode.
Fail over to RGB if alpha is not supported by target format, e.g. jpeg.

Similarly the transparency=0 optional argument triggers a traceback, even for png:

Traceback (most recent call last):
  File "./generator", line 100, in <module>
    generate_video_thumbnail(arguments)
  File "./generator", line 39, in generate_video_thumbnail
    generate_sprite_from_frames(outputPrefix, columns, size, output)
  File "./generator", line 89, in generate_sprite_from_frames
    finalImage.save(output, transparency=0)
  File "/Users/chris/.local/lib/python2.7/site-packages/PIL/Image.py", line 1935, in save
    save_handler(self, fp, filename)
  File "/Users/chris/.local/lib/python2.7/site-packages/PIL/PngImagePlugin.py", line 799, in _save
    raise IOError("cannot use transparency for this mode")
IOError: cannot use transparency for this mode

fixed by #14