Anki media file corruption when exporting PNG files

I am running into this exact issue when exporting a deck with PNG files:
import - Image doesn’t show in Anki (although the media file exists) - Stack Overflow

I think it may have something to do with the filenames as the last commenter notes. All the manual checking I’ve done has the errors in PNG files with long filenames such as:
Some SVG files are also corrupted.

Files like “paste-9d0f8f77e869e784d7881a128e96c081b44f7e4e.jpg” are working.

I am on the latest desktop Version ⁨2.1.63 (f356f177)⁩.
I have several hundred if not thousands of media cards that are working fine with myself, but are broken on exports, and fixing them manually seems hopeless.

Can someone confirm if this is a known issue or something that’s been overlooked? Exporting as a collection isn’t much of an option for sharing since it keeps scheduling data.


I’ve manually checked all .SVG files and its also an issue with all those files.

The image in your screenshot is not in your AnkiWeb account, so there’s a chance it’s not on your local device either. If you return to the profile you exported from and look up that specific card by searching for that filename, does the image show?

I was trying to fix it on my own in the meantime. I fixed my particular issue by converting all my pictures into webp and checking support older anki versions. It seems to be a combination of issues, I think?

PNG and WEBP exports are all broken when exporting with ‘support older anki versions’ UNchecked.
WEBP only is working when exporting with ‘support older anki verisions’ checked.

SVG and PNG files related to the ‘image occlusion enhanced’ addon are broken when displaying the exported versions (they work fine in my main deck), but when I try to edit the image occlusion it opens the png just fine and the images are not corrupted. For example, tmp9j1ljpw0.png on my ankiweb.

I updated my ankiweb email address on this forum account to my work email associated with the deck in question. Previously I had a personal email this account so it wouldn’t be on that ankiweb.

That media file in your screenshot (and lots more) appears to have been deleted recently from your account. Have you been making manual changes to your media folder? Would you like me to restore recently deleted media files in AnkiWeb?

I would be somewhat surprised if the support for older versions switch had any effect on which images are exported (correctly).

The file still exists for me on my local machine. I deleted all those other pictures because I converted everything into .webp in an effort to get it exporting well, and it seems to partially work.

Here are exports I just made with the same behavior I described before
support older anki verisions: crackthecore2021 support.apkg - Google Drive
Don’t support older anki verisions: crackthecore2021 no support.apkg - Google Drive

I create separate fresh new profiles for each export, import each into their own profiles, and check the pictures. The support older anki verisions export has most working (with PNG, SVG errors). The Don’t support older anki verisions export has most pictures not working (WEBP, PNG, and SVG).


The picture in question seems to be working in the support version, but most other PNG/SVGs related to the ‘image occlusion enhanced’ app are not. The odd thing is, the pictures don’t appear to be corrupted in the support version, because I can open them manually and they look fine. They just won’t display properly within anki.

The file "tmp9j1ljpw0.png" command says that:

crackthecore2021 support (looks good)

tmp9j1ljpw0.png: PNG image data, 986 x 741, 8-bit/color RGBA, non-interlaced

crackthecore2021 no support (looks broken)

tmp9j1ljpw0.png: Zstandard compressed data (v0.8+), Dictionary ID: None

If they display correctly after restarting Anki and not viewing any cards with the same filenames in other profiles first, it’s very likely caused by caching.

If I first view 1.jpg (a cat) in the 1st profile, it’ll be cached, and then switch to the 2nd profile (without closing Anki) and view 1.jpg (a dog) in the 2nd profile, the same filename but a different picture, I’ll see 1.jpg from the 1st profile.

Thank you both. This did turn out to be a bug, but it should have affected any file in the .apkg, not only certain files. If you attempt to import the .apkg into a fresh profile (or delete the cards first), they should import correctly after you update to Release 2.1.64rc1 · ankitects/anki · GitHub


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.