Pasting image from clipboard seems to download the image anyway

I’m on Linux, gnome with x11 and when I add images to notes, I often just click on copy image in Chrome, and paste to anki.

However, I have been noticing Anki freezing for short or long time (seconds) after I paste each image which shouldn’t happen if it’s pasted from the clipboard locally.

Moreover, I occasionally got popups of 4xx errors after the freeze (but the image seems to paste successfully anyways. I didn’t bother to inspect the field html when those happened but I suspect Anki falls back to use a remote url, as my later example shows below.)

After a successful paste, I usually get this in my field:

<img alt="国際公務員 | 法律・公務員 | 未来の仕事を探せ! | 未来の仕事 | 学研 ..." src="be28e623c96b6e8f914752a00cc41728.jpg">

an img tag sometimes with an alt field and a local hashed and downloaded image file.

Today, rarely after tens of seconds of freezing, I got an SSL error, but the image successfully appeared anyway:

<img alt="発熱」は何度から?熱が出る原因・熱が出た際の対処法について - 健康 ..." src="https://www.suntory-kenko.com/column2/wp-content/uploads/2023/01/928-1.jpg">

and it seems to be a remote image instead, as I checked my media folder and it didn’t have the image.

I wonder why is an internet request even neccesary in this case? xclip -selection clipboard -t image/png -o > /tmp/test.png on my terminal would just paste the image instantly too.

Additionally, If I would just copy a screenshot to the clipboard using my system screenshot tool though, it pastes as:

<img src="paste-24e3c3884be88f587a08c765c7961bc7c93f573a.jpg">

and I indeed observe no internet request.

1 Like

This usually depends on what you picked up in your copy buffer, which is mostly determined by how the website is serving up the image. But even when you are pasting the actual image file and not a link, Anki still needs to save the file to your collection media, compare it to your existing media to avoid duplication, encode/de-duplicate the filename, and add the HTML that you see in the field – Media - Anki Manual. So there are a few things going on there.

If the freezing is happening consistently, you should go through the Troubleshooting Checklist – Troubleshooting - Anki Manual . But not on that list is Check Media – Media - Anki Manual – which you should definitely consider doing. You’ve got over 11GB of media in your account, which is built-in drag on the media-attaching process (not to mention syncing and server space). Anything you can do to cut that down will probably help.

To fix the images that were inadvertently added as remote, but intended to be local – you can use the Localize Media add-on.