You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

18 lines
316 B

package service
import (
"image"
"io"
"go-common/library/log"
)
// Pixel get width height
func Pixel(file io.Reader) (width, height int, err error) {
var c image.Config
if c, _, err = image.DecodeConfig(file); err != nil {
log.Error("decode config error", err)
return
}
return c.Width, c.Height, err
}