PIL - Convert GIF Frames to JPG

后端 未结 3 1200
无人共我
无人共我 2020-12-03 05:13

I tried to convert an gif to single images with Python Image Library, but it results in weird frames

The Input gif is:

Source Image http://longcat.de/gif_exa

3条回答
  •  臣服心动
    2020-12-03 05:58

    When viewing an image on an image viewer, even when transparency is set to zero, it tends to display the image as black. One way to be sure that your image is truly transparent is to merge it over another. The 'emoticon' should be seen whilst not obstructing the other image.Try:

    background = Image.open('someimage.jpg') #an existing image
    foreground = Image.open('foo.jpg') #one of the above images
    background.paste(foreground, (0,0), foreground)
    background.save('trial.jpg') #the composite image
    

    Theoretically, if you open 'trial.jpg' in the image viewer and the content of the initial image is preserved and on top of it lies the foo image then you'll know for sure if it's just the image viewer and your images are fine...

提交回复
热议问题