diff --git a/cmd/cory-bin/main.go b/cmd/cory-bin/main.go index a28ebed..0899ab1 100644 --- a/cmd/cory-bin/main.go +++ b/cmd/cory-bin/main.go @@ -57,12 +57,12 @@ func dump(filename string, output string) { } out := new(bytes.Buffer) printIf("rendering %d animation(s)\n", n.AnimationCount) - frames, err := nori.RenderAnimations(n) + animations, err := nori.RenderAnimations(n) if err != nil { log.Panicln("animation: %s", err) } printIf("saving to %s \n", output) - if err := utils.ZipApngs(out, frames); err != nil { + if err := utils.ZipApngs(out, animations); err != nil { log.Panicln("zipping: %s", err) } printIf("done in %v \n", time.Now().Sub(start)) diff --git a/readme.md b/readme.md index d08c500..4f901b2 100644 --- a/readme.md +++ b/readme.md @@ -4,6 +4,30 @@ common/nori provides structs and decoders for nori file +usage: + +``` +import ( + "log" + "git.tuxpa.in/a/gotagonist/common/nori" +) +func main() { + n, err := nori.FromFile(filename) + if err != nil { + log.Panicln("decode: %s", err) + } + // uses apng encoder/decoder from https://gitlab.com/gfxlabs/gfximg + animations, err := n.RenderAnimations(n) + if err != nil { + log.Panicln("render: %s", err) + } + // each animation has slice of frames + // each frame contains an image.Image, if another format is needed + // internally they are stored as &image.NRGBA64{} + log.Println(animations[0].Frames[]) +} +``` + ## cory cmd/cory is command line util for working with nori files