1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00
imgproxy/imagemeta/gif.go

27 lines
411 B
Go
Raw Normal View History

2019-12-25 11:06:15 +02:00
package imagemeta
import (
"io"
2021-05-13 15:58:44 +02:00
2021-09-30 16:23:30 +02:00
"github.com/imgproxy/imgproxy/v3/imagetype"
)
2019-12-25 11:06:15 +02: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 11:06:15 +02:00
return &meta{
2021-05-13 15:58:44 +02:00
format: imagetype.GIF,
2019-12-25 11:06:15 +02:00
width: int(tmp[6]) + int(tmp[7])<<8,
height: int(tmp[8]) + int(tmp[9])<<8,
}, nil
}
func init() {
RegisterFormat("GIF8?a", DecodeGifMeta)
}