2022-03-25 22:19:32 +00:00
|
|
|
# nri file reader
|
|
|
|
|
|
|
|
## about
|
|
|
|
|
|
|
|
common/nori provides structs and decoders for nori file
|
|
|
|
|
2022-03-25 22:27:42 +00:00
|
|
|
usage:
|
|
|
|
|
|
|
|
```
|
|
|
|
import (
|
|
|
|
"log"
|
2022-03-25 22:34:32 +00:00
|
|
|
"git.tuxpa.in/a/nori"
|
2022-03-25 22:27:42 +00:00
|
|
|
)
|
2022-03-25 22:28:58 +00:00
|
|
|
|
2022-03-25 22:27:42 +00:00
|
|
|
func main() {
|
2022-03-25 22:28:48 +00:00
|
|
|
n, err := nori.FromFile(filename)
|
|
|
|
if err != nil {
|
|
|
|
log.Panicln("decode: %s", err)
|
|
|
|
}
|
2022-03-25 22:27:42 +00:00
|
|
|
// uses apng encoder/decoder from https://gitlab.com/gfxlabs/gfximg
|
2022-03-26 06:52:59 +00:00
|
|
|
animations, err := n.RenderAnimationsApng(n)
|
2022-03-25 22:27:42 +00:00
|
|
|
if err != nil {
|
2022-03-25 22:28:48 +00:00
|
|
|
log.Panicln("render: %s", err)
|
2022-03-25 22:27:42 +00:00
|
|
|
}
|
|
|
|
// 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[])
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2022-03-25 22:19:32 +00:00
|
|
|
## cory
|
|
|
|
|
|
|
|
cmd/cory is command line util for working with nori files
|
|
|
|
|
|
|
|
get a zip file of animations from a nori file
|
|
|
|
|
|
|
|
usage: `./cory -d -f=filename.nri -o=output.zip`
|
|
|
|
|
|
|
|
optionally, use webserver
|
|
|
|
|
|
|
|
start: `./cory -serve`
|
|
|
|
|
|
|
|
example with curl: `curl -X POST --data-binary "@filename.nri" localhost:3333/animations --output output.zip`
|
|
|
|
|
|
|
|
### building cory
|
|
|
|
|
|
|
|
```
|
|
|
|
make cory
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### docker
|
|
|
|
|
|
|
|
oh yeah there's also a docker image for cory lol
|
|
|
|
|
|
|
|
```
|
|
|
|
make docker
|
|
|
|
```
|
2022-03-25 22:20:50 +00:00
|
|
|
|
|
|
|
and to run server
|
|
|
|
|
|
|
|
```
|
|
|
|
make server-run
|
|
|
|
```
|