update readme
This commit is contained in:
parent
ac8a79db87
commit
18a0a84b99
|
@ -57,12 +57,12 @@ func dump(filename string, output string) {
|
||||||
}
|
}
|
||||||
out := new(bytes.Buffer)
|
out := new(bytes.Buffer)
|
||||||
printIf("rendering %d animation(s)\n", n.AnimationCount)
|
printIf("rendering %d animation(s)\n", n.AnimationCount)
|
||||||
frames, err := nori.RenderAnimations(n)
|
animations, err := nori.RenderAnimations(n)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicln("animation: %s", err)
|
log.Panicln("animation: %s", err)
|
||||||
}
|
}
|
||||||
printIf("saving to %s \n", output)
|
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)
|
log.Panicln("zipping: %s", err)
|
||||||
}
|
}
|
||||||
printIf("done in %v \n", time.Now().Sub(start))
|
printIf("done in %v \n", time.Now().Sub(start))
|
||||||
|
|
24
readme.md
24
readme.md
|
@ -4,6 +4,30 @@
|
||||||
|
|
||||||
common/nori provides structs and decoders for nori file
|
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
|
## cory
|
||||||
|
|
||||||
cmd/cory is command line util for working with nori files
|
cmd/cory is command line util for working with nori files
|
||||||
|
|
Loading…
Reference in New Issue