Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ref#45 add gif rate support #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
Nth int
Repeat int
V, VV bool
Interval int
)

type flagArray []string
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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))
}
}
}
Expand Down