from PIL import Image
import sys
with Image.open(sys.argv[1]) as im:
for i in range(im.n_frames):
im.seek(i)
im.save("s"+str(i)+".png")