Guest User

Untitled

a guest
Jun 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. from PIL import Image, ImageSequence
  4. import sys, os
  5. filename = sys.argv[1]
  6. im = Image.open(filename)
  7. original_duration = im.info['duration']
  8. frames = [frame.copy() for frame in ImageSequence.Iterator(im)]
  9. frames.reverse()
  10.  
  11. from images2gif import writeGif
  12. writeGif("reverse_" + os.path.basename(filename), frames, duration=original_duration/1000.0, dither=0)
  13.  
  14. #load your frames
  15. frames = ...
  16. #create a video writer
  17. writer = cvCreateVideoWriter(filename, -1, fps, frame_size, is_color=1)
  18. #and write your frames in a loop if you want
  19. cvWriteFrame(writer, frames[i])
  20.  
  21. import os
  22.  
  23. os.system("mencoder ...")
Add Comment
Please, Sign In to add comment