阅读http://golang.org/pkg/image
// you need the image package, and a format package for encoding/decodingimport ( "bytes" "image" "image/jpeg" // if you don't need to use jpeg.Enpre, use this line instead // _ "image/jpeg" "github.com/nfnt/resize")// Decoding gives you an Image.// If you have an io.Reader already, you can give that to Depre // without reading it into a []byte.image, _, err := image.Depre(bytes.NewReader(data))// check errnewImage := resize.Resize(160, 0, original_image, resize.Lanczos3)// Enpre uses a Writer, use a Buffer if you need the raw []byteerr = jpeg.Enpre(someWriter, newImage, nil)// check err
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)