Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add wrapper of ImageMagick to make animated gif

  • Loading branch information...
commit 90217945ffab4df58013d86c5cae8b05e6019af7 1 parent 9cf3b6f
@yAngle authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 _bin/movie-maker
View
22 _bin/movie-maker
@@ -0,0 +1,22 @@
+#!/usr/bin/env python2
+
+import time
+import argparse
+from utils import execute, key_natural
+
+parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=True)
+parser.add_argument('filenames', nargs='+', metavar='FILENAME', help='input filenames')
+parser.add_argument('--delay', type=int, default=100, help='delay between frames in unit of 10ms')
+parser.add_argument('--loop', type=int, default=0, help='# of loops before stop')
+parser.add_argument('--density', type=int, default=300, help='resolution of the image')
+parser.add_argument('--output', default=None, metavar='42.gif', help='output filename')
+
+args = parser.parse_args()
+i = ' '.join(sorted(args.filenames, key=key_natural)) # sorted naturally
+o = args.output or time.strftime('%y%m%d-%H%M%S.gif')
+
+cmd = 'convert -delay {a.delay} -loop {a.loop} -density {a.density} {i} {o}'.format(a=args, i=i, o=o)
+
+print 'converting...',
+execute(cmd)
+print
Please sign in to comment.
Something went wrong with that request. Please try again.