From 227bdc5b3c7ba5c5579a34d8cde31cf33265394e Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Tue, 21 Nov 2017 17:44:02 +0100 Subject: [PATCH] Ref#45 add gif rate support --- README.md | 1 + main.go | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebe8af4b..d0453627 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ Small input images should be used (like 256x256px). You don't need the detail an | `j` | 0 | number of parallel workers (default uses all cores) | | `v` | off | verbose output | | `vv` | off | very verbose output | +| `int` | 50 | interval between frame in a gif in millis (works only with .gif output)| ### Output Formats diff --git a/main.go b/main.go index 75d776c2..292f6312 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,7 @@ var ( Nth int Repeat int V, VV bool + Interval int ) type flagArray []string @@ -75,6 +76,7 @@ func init() { flag.IntVar(&Repeat, "rep", 0, "add N extra shapes per iteration with reduced search") flag.BoolVar(&V, "v", false, "verbose") flag.BoolVar(&VV, "vv", false, "very verbose") + flag.IntVar(&Interval, "int", 50, "interval between frame in a gif") } func errorMessage(message string) bool { @@ -111,6 +113,9 @@ func main() { ok = errorMessage("ERROR: number argument must be > 0") } } + if Interval < 0 { + ok = errorMessage("ERROR: negative frame interval not accepted") + } if !ok { fmt.Println("Usage: primitive [OPTIONS] -i input -o output -n count") flag.PrintDefaults() @@ -195,7 +200,7 @@ func main() { check(primitive.SaveFile(path, model.SVG())) case ".gif": frames := model.Frames(0.001) - check(primitive.SaveGIFImageMagick(path, frames, 50, 250)) + check(primitive.SaveGIFImageMagick(path, frames, Interval, 250)) } } }