Documentation ¶
Overview ¶
Package deanimator provides a common interface for detecting animation and deanimation of image data streams. Multiple image formats are supported and additional formats can be registered by consumers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFormat = errors.New("deanimator: unknown format")
ErrFormat indicates that decoding encountered an unknown format.
Functions ¶
func IsAnimated ¶
IsAnimated returns whether the image data in the reader is a known format and is recognized as having multiple animation frames. If a format is not matched, ErrFormat is returned, otherwise a flag indicating whether it is animated and the format name are returned. This function only consumes as much of the reader as is necessary to determine if something is animated.
func RegisterFormat ¶
func RegisterFormat(name, magic string, isAnimated func(io.Reader) (bool, error), renderFirstFrame func(io.Reader, io.Writer) error)
RegisterFormat allows consumers to create their own deanimation format support,the format registration/handling code for deanimator closely follows that of the image package in the std library. To create your own format handling, you can read more about its magic string matching to determing the best way to structure your registration.
func RenderFirstFrame ¶
RenderFirstFrame renders the first frame of an animated image to the provided writer. It will read as much of the reader as is necessary to do so. It will also return the matching format. If no format matched, it will return ErrFormat.
Some implementations of RenderFirstFrame may change the encoding format of the first frame (for example from GIF to PNG).
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package gif provides animated GIF image format support for deanimator.
|
Package gif provides animated GIF image format support for deanimator. |
parser
A modified version of golang 1.18's image/gif/reader.go Only reads the first frame of a gif Also includes patch from https://go-review.googlesource.com/c/go/+/329329
|
A modified version of golang 1.18's image/gif/reader.go Only reads the first frame of a gif Also includes patch from https://go-review.googlesource.com/c/go/+/329329 |
Package png provides animated PNG image format support for deanimator.
|
Package png provides animated PNG image format support for deanimator. |
Package webp provides animated WEBP image format support for deanimator.
|
Package webp provides animated WEBP image format support for deanimator. |
Package window provides a windowed reader implementation used by some of the image format packages.
|
Package window provides a windowed reader implementation used by some of the image format packages. |