Video Cooking #3 - Read frames from gif
Reading and creating gif files is much easier using PIL than OpenCV.
Read frame from gif file
import argparse from PIL import Image, ImageSequence parser = argparse.ArgumentParser(description='gif run') parser.add_argument('--file', type=str, required=True, help='gif file name') args = parser.parse_args() im = Image.open(args.file) index = 1 for frame in ImageSequence.Iterator(im): frame.save("frame%d.png" % index) index += 1
댓글
댓글 쓰기