1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-08 10:45:04 +02:00
imgproxy/image_size/gif.go
2019-09-25 21:47:37 +06:00

25 lines
358 B
Go

package imageSize
import (
"io"
)
func DecodeGifMeta(r io.Reader) (*Meta, error) {
var tmp [10]byte
_, err := io.ReadFull(r, tmp[:])
if err != nil {
return nil, err
}
return &Meta{
Format: "gif",
Width: int(tmp[6]) + int(tmp[7])<<8,
Height: int(tmp[8]) + int(tmp[9])<<8,
}, nil
}
func init() {
RegisterFormat("GIF8?a", DecodeGifMeta)
}