|import os, sys|
|GIF = ".gif"|
|MP4 = ".mp4"|
|AVI = ".avi"|
|def convertFile(inputpath, targetFormat):|
|outputpath = os.path.splitext(inputpath) + targetFormat|
|reader = imageio.get_reader(inputpath)|
|fps = reader.get_meta_data()['fps']|
|writer = imageio.get_writer(outputpath, fps=fps)|
|for i,im in enumerate(reader):|
I've been stuck on this error code...
Any suggestions on why? I'm new to python so it is likely a problem with me not the code I expect. But I'd really like it to work so I figured who better to ask than you?
When I run:
How to Convert Video to GIF Using Python
Under the hood all the GIF-writing methods use
Problem 1: Transparency of frames
Symptom: Output GIF has bad quality on texts. Looks like really bad antialiasing.
Reason: The alpha channel of frames is just cut away by pillow, but unless there wasn't any transparency this is not the correct way to remove transparency.
Solution: Make sure to create frames (e.g. matplotlib figures) with white background so cutting away the alpha channel doesn't break the colors.
Problem 2: Grizzly output GIFs
Symptom: Output GIF has artifacts, even though the frames didn't. (Like in the example from the link above.)
Solution: Try to call