Skip to content
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

Error 'Frame 2 has a different width' since Chrome version 108 #72

Open
xuejianxianzun opened this issue Dec 3, 2022 · 1 comment
Open

Comments

@xuejianxianzun
Copy link

xuejianxianzun commented Dec 3, 2022

Images that used to work fine now fail to convert with this error:
20221203_223104

The size of each frame image is wrong.

I found the reason, since this project seems to be unmaintained, I didn't submit a PR, but as an issue, so that more people who encounter this error can see it.

var p2 = str.substr(577)
// change into
var p2 = str.substr(ChromeVer >= 108 ? 497 : 577)

Since Chrome 108 the 80-byte whitespace is removed, so the offset of the second part is 577 - 80 = 497.

I added code to detect ChromeVer before this.encodeFrames:

    let ChromeVer = 1
    const test = navigator.appVersion.match(/.*Chrome\/([0-9]+)/)
    if(test && test[1]){
      ChromeVer = parseInt(test[1])
    }
@xuejianxianzun
Copy link
Author

Use canvas.toDataURL('image/webp') to convert the same image and save it as a webp image.

Edge(107) has 80 bytes of 0:
edge

Chrome (108) removed these bytes, resulting in a conversion error.
ch

@xuejianxianzun xuejianxianzun changed the title Error 'Uncaught frame [x] has a different width' since Chrome version 108 Error 'Frame 2 has a different width' since Chrome version 108 Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant