Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SelfishPig
Copy link
Contributor

After a recent commit, images are set to decode asynchronously. However, decoding is not initiated until the image is displayed. This small change allows images to begin decoding immediately, which greatly speeds up loading times (especially on the answer side) of cards with a lot of images (AnKing).

@Luc-Mcgrady
Copy link
Contributor

Luc-Mcgrady commented Dec 18, 2025

Is this the same as decoding the images synchronously? Would

    if (!img.getAttribute("decoding")) {
        img.decoding = "sync";
    }

give the same result?

Here is the relevant issue and pull request:

It is possible you would be interested in the upcoming reviewer in #4289 as this pre-loads the images of the next card, although this will not help for the first card.

@SelfishPig
Copy link
Contributor Author

SelfishPig commented Dec 18, 2025

Whoops, you're right. I've fixed it. This change actually causes the backside images to be decoded while on the front of the card.

To demonstrate, here's a test card loading an 8000x8000 image.

Old behavior:
old

New behavior:
async decode

Copy link
Contributor

@Luc-Mcgrady Luc-Mcgrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Be sure to add yourself to the CONTRIBUTORS file so the CLI can pass.

@abdnh abdnh merged commit 8f21445 into ankitects:main Dec 20, 2025
1 check passed
@abdnh
Copy link
Collaborator

abdnh commented Dec 20, 2025

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants