1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-01-23 11:14:48 +02:00

27 lines
411 B
Go
Raw Normal View History

2019-12-25 15:06:15 +06:00
package imagemeta
import (
"io"
2021-05-13 19:58:44 +06:00
2021-09-30 20:23:30 +06:00
"github.com/imgproxy/imgproxy/v3/imagetype"
)
2019-12-25 15:06:15 +06:00
func DecodeGifMeta(r io.Reader) (Meta, error) {
var tmp [10]byte
_, err := io.ReadFull(r, tmp[:])
if err != nil {
return nil, err
}
2019-12-25 15:06:15 +06:00
return &meta{
2021-05-13 19:58:44 +06:00
format: imagetype.GIF,
2019-12-25 15:06:15 +06:00
width: int(tmp[6]) + int(tmp[7])<<8,
height: int(tmp[8]) + int(tmp[9])<<8,
}, nil
}
func init() {
RegisterFormat("GIF8?a", DecodeGifMeta)
}