- Zero Dependencies - no std/3rd imports
- High Performance - hand-wringing DFA instead of regex/wildcard expression
- Widely Format - bmp/bpm/gif/jpeg/mng/pbm/pcx/pgm/png/ppm/psd/ras/tiff/webp/xbm/xpm
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