-
Notifications
You must be signed in to change notification settings - Fork 5
decode: wasm error: invalid table access #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, a test image would be nice. You can send it to me by email, it is listed on github profile. |
actually the image in this Issue has the problem (I verified it locally). func img_go(imageData []byte) ([]byte, error) {
// Decode the image data
img, format, err := image.Decode(bytes.NewReader(imageData))
if err != nil {
return nil, err
} |
Thanks. Looks like a tricky issue, will check when I find the time. I never seen an image that is |
I guess I could just detect such images and skip |
Unfortunately,I can't speak on a solution, but we switched to libvips b/c users were uploading these images. Other c-based jpeg decoders also worked (like https://github.com/h2non/bimg) |
Ok, this is fixed in e9c61fe and I tagged a new version. I just use the RGBA read scanlines when the image is YCbCr421. It will be slower than raw data but I don't think that is important in this case. |
I added one more case I found in issues. If you can confirm it works this can be closed. |
ok, I will test some images I have and let you know. |
I tested v0.2.2 with another unsupported chroma jpg successfully, but the performance isn't great compared to other libraries with both unsupported-chroma and a large "normal" jpgs: This is the timing and compression results with 1200x1200 213KB unsupported-chroma jpg:
These are the processing / load times for resizing and compressing this 19Mb unsplash image with various tools on my Apple M1 Pro 32GB RAM:
The CI system at my job doesn't support cgo, which is why this project caught my eye. I ended up passing images to vips cli via stdin/stdout to process chroma-issue images efficiently. |
You cannot really compare C libraries with optimized assembly instructions and std lib or wasm. It is fine enough that the performance is similar to std, that there is no cgo, and that creates smaller files. |
I'll close the issue since the main point has been fixed. |
This decoder has the same issue that golang has with certain jpg formats:
golang/go#62421
output:
If you need a test image, can you email me at kcoleman.me/contact? I don't want to post my test image online.
The text was updated successfully, but these errors were encountered: