Answer the question
In order to leave comments, you need to log in
Python and overlaying a watermark on an animated GIF?
The first thing I tried was to use PIL. As it turned out, saving an uncorrupted image is not so easy.
imbase = Image.open('/path/to/img.gif')<br>
imwater = Image.open('/path/to/watermark.png')<br>
frames = [frame.copy() for frame in ImageSequence.Iterator(imbase)]<br>
frames.reverse()<br>
for frame in frames:<br>
frame.paste(imwater,(imbase.size[0]-imwater.size[0],imbase.size[1]-imwater.size[1]),imwater)<br>
images2gif.writeGif('/path/to/new.gif', frames)<br>
Answer the question
In order to leave comments, you need to log in
PIL had to be abandoned in favor of PythonMagickWand (binding to the ImageMagick API). There were attempts to use pgmagick, but as it turned out the documentation was outdated. The code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question