(path string, frames []image.Image, delay, lastDelay int)
| 85 | } |
| 86 | |
| 87 | func SaveGIFImageMagick(path string, frames []image.Image, delay, lastDelay int) error { |
| 88 | dir, err := ioutil.TempDir("", "") |
| 89 | if err != nil { |
| 90 | return err |
| 91 | } |
| 92 | for i, im := range frames { |
| 93 | path := filepath.Join(dir, fmt.Sprintf("%06d.png", i)) |
| 94 | SavePNG(path, im) |
| 95 | } |
| 96 | args := []string{ |
| 97 | "-loop", "0", |
| 98 | "-delay", fmt.Sprint(delay), |
| 99 | filepath.Join(dir, "*.png"), |
| 100 | "-delay", fmt.Sprint(lastDelay - delay), |
| 101 | filepath.Join(dir, fmt.Sprintf("%06d.png", len(frames)-1)), |
| 102 | path, |
| 103 | } |
| 104 | cmd := exec.Command("convert", args...) |
| 105 | if err := cmd.Run(); err != nil { |
| 106 | return err |
| 107 | } |
| 108 | return os.RemoveAll(dir) |
| 109 | } |
| 110 | |
| 111 | func NumberString(x float64) string { |
| 112 | suffixes := []string{"", "k", "M", "G"} |
nothing calls this directly
no test coverage detected
searching dependent graphs…