nori/common/nori/export.go
2022-03-25 01:00:01 -05:00

20 lines
409 B
Go

package nori
import "gitlab.com/gfxlabs/gfximg/apng"
func (n *Nori) ExportAnimation() *apng.APNG {
g := n.Gawi
a := &apng.APNG{
Frames: make([]apng.Frame, 0, len(g.Images)),
}
for i := 0; i < len(g.Images); i++ {
fr := apng.Frame{
Image: g.Images[i].Frame,
DelayNumerator: uint16(g.Images[i].Delay),
DelayDenominator: 1000,
}
a.Frames = append(a.Frames, fr)
}
return a
}