Fast Image Type,Width,Height detection for go, up to 16 image formats support.
try on https://play.golang.org/p/8yHaCknD1Rm
package main
import (
"fmt"
"github.com/phuslu/fastimage"
)
var data = []byte("RIFF,-\x00\x00WEBPVP8X\n\x00\x00\x00" +
"\x10\x00\x00\x00\x8f\x01\x00,\x01\x00VP8X\n\x00\x00\x00\x10\xb2" +
"\x01\x00\x00WEB\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00" +
"\x00WEB\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00\x00W" +
"EB\x01\x00VP8X\n\x00\x00\x00\x10\xb2\x01\x00\x00WEB"")
func main() {
fmt.Printf("%+v\n", fastimage.GetInfo(data))
}
// Output: {Type:webp Width:400 Height:301}
$ go get github.com/phuslu/fastimage/cmd/fastimage
$ fastimage banner.png
png image/png 320 50