webp-sh / webp_server_go

Go version of WebP Server. A tool that will serve your JPG/PNG/BMP/SVGs as WebP/AVIF format with compression, on-the-fly.

Home Page:https://docs.webp.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't encode source image: VipsJpeg: Invalid SOS parameters for sequential JPEG

bhzhu203 opened this issue · comments

Original image http://static-erp.selleroa.com/yfni/test/1684547034231096980.jpg

WARN[2023-05-20 05:28:13][188:main.webpEncoder()] Can't encode source image: VipsJpeg: Invalid SOS parameters for sequential JPEG

Stack:
goroutine 3845 [running]:
runtime/debug.Stack()
	/root/go/src/runtime/debug/stack.go:24 +0x65
github.com/davidbyttow/govips/v2/vips.handleVipsError()
	/root/gopath/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/error.go:38 +0x57
github.com/davidbyttow/govips/v2/vips.handleSaveBufferError(0xc000d40a48?)
	/root/gopath/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/error.go:31 +0x25
github.com/davidbyttow/govips/v2/vips.vipsSaveToBuffer({0x7f9714013190, 0x0, 0x2, 0x0, 0x1, 0x55, 0x0, 0x0, 0x1, 0x0, ...})
	/root/gopath/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/foreign.go:465 +0xb7
github.com/davidbyttow/govips/v2/vips.vipsSaveWebPToBuffer(0x7f9714013190, {0x1, 0x55, 0x0, 0x0, 0x0, {0x0, 0x0}})
	/root/gopath/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/foreign.go:386 +0x1f8
github.com/davidbyttow/govips/v2/vips.(*ImageRef).ExportWebp(0xc006186050, 0x33?)
	/root/gopath/pkg/mod/github.com/davidbyttow/govips/v2@v2.13.0/vips/image.go:924 +0xc5
main.webpEncoder({0xc00f320140, 0x33}, {0xc000d8a500, 0x37}, 0x55, {0xb8ca58?, 0xc0003db860?})
	/root/webp_server_go/encoder.go:180 +0x17b
main.convertImage({0xc00f320140, 0x33}, {0xc000d8a500, 0x37}, {0xaec5ab, 0x4}, {0xc0003cf4a0?, 0xc000027180?})
	/root/webp_server_go/encoder.go:98 +0x2db
main.convertFilter.func2()
	/root/webp_server_go/encoder.go:55 +0x5c
created by main.convertFilter
	/root/webp_server_go/encoder.go:54 +0x215
 to WebP

There are two problems here:

  1. The image might be corrupted. (Through it seems fine when opening through image viewer on my computer)
  2. When convert fails, the original image should be returned, this will be fixed by #209

Hello , aliyun CDN webp service can convert the corrupted jpg image to webp correctly.

http://cdn3.selleroa.com/yfni/test/1684547034231096980.jpg

@n0vad3v