Skip to content

Instantly share code, notes, and snippets.

@golangfan
Last active August 29, 2015 13:56
Show Gist options
  • Save golangfan/9323814 to your computer and use it in GitHub Desktop.
Save golangfan/9323814 to your computer and use it in GitHub Desktop.
Go语言的标准包 image测试说明
测试了8000张图片,30张图片无法识别,会导致以下错误
import (
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
_ "code.google.com/p/go.image/bmp"
_ "code.google.com/p/go.image/tiff"
)
im, format, err := image.Decode(reader)
if err != nil {
log.Fatal(err)
}
A jpeg 包
错误1: EOF [这个像是一个未知错误]
错误2: unsupported JPEG feature: SOF has wrong length [这像是一个未支持的图片格式]
B bmp 包
错误3: bmp: unsupported BMP image [这像是一个未支持的图片格式]
C gif 包
错误4: gif: unknown block type: 0x03
错误5: gif: not enough image data
错误6: gif: too much image data
错误7: unexpected EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment