Media disappearing/becoming corrupt

I am using a downloaded Anki package for a course; I know of classmates who have had no issue with the package + media.

When I first downloaded the package, the media files didn’t load, so I had to redownload it onto a new user, which worked. However, I have now made much progress, and it seems to have suddenly reverted back–the images won’t load nor let me open them. It may also be related to my syncing it to my email account, which I had done a few hours before this problem occurred.

I have tried to load it onto a new user as before, which works, but I don’t want to lose all my learning process. I tried to export the one I was using (has learning progress + won’t load images) onto this new user, but it doesn’t apply the learning process as all the cards are the same. Please let me know if there is a way around this; I’m fine using a different user if it works!

I have also tried to load the media itself–in the deck with my learning progress, all of the files in the collection.media folder (I’m on Mac) return the error message “It may be damaged or use a file format that Preview doesn’t recognize.”
However, in the newly redownloaded deck where the media works, they open just fine–but, copying the media into the other folder works for about 2 seconds before they start showing the same error message.

AnkiWeb also doesn’t allow me to view the images; I’ve tried to load backups, restart Anki, open in safe mode, etc. Also, the deck itself is really slow, taking 1-3 seconds to buffer before flipping a card or moving to the next card.

Could you please tell us:

  • Do you happen to be using either AnkiHub or AnkiCollab or AMBOSS?
  • You used the term “Anki package”. Was the “package” that you downloaded just a simple deck? Or, did the package include other things?
  • Where did you download the “Anki package” from? Was it from ankiweb.net? If not, from where?
  • Could you provide the name of one of the media files in your collection.media folder that is experiencing the problem? And, what type of media it is (for example: GIF image, JPEG image, etc.)?
  1. I don’t believe so; I am just using the standard Anki app downloaded (I also updated it since this happened) from the website for my MacOS
  2. It is just a simple deck; apologies for using the term “package” –> it’s downloaded as an .apkg
  3. Downloaded from Canvas – app/websites for classes that many universities use; people can upload files, and I believe it was exported by deck maker and uploaded onto Canvas
  4. All of them are “.jpg”s; and classified by my Macbook as a JPEG image. For example, paste-029c3b20463543504029d7104a95b994035e0102.jpg

Interestingly, some photos are opening when I click (at random) photos in the collection.media folder. However, even when I preview cards (from Browsing, I can look up the card that the image that works is attached to), the image still won’t load.

Not sure if I mentioned this before, but on the Anki card itself, where the image is supposed the be there is a generic photo file icon.

Thanks for trying to help and let me know if I can provide any more information!

Thank you for clarifying that it is just an ordinary Anki deck from an .apkg file.

If you can open an image file from Finder, it means that the file is not actually corrupt. Are all the image files opening just fine from Finder? Is the only problem that the images aren’t appearing in Anki?

Regarding that specific image file named paste-029c3b20463543504029d7104a95b994035e0102.jpg that you mentioned:

  • (First, please open the file from Finder, just to double-check that it isn’t corrupt and should work just fine.)
  • Then, in Anki please Browse to the note or card on which that specific image is used.
  • The image should appear (though you say it doesn’t), and if you toggle the HTML Editor for the image field, the contents should be: <img src="paste-029c3b20463543504029d7104a95b994035e0102.jpg">

If the image doesn’t appear in Anki, could you please copy and paste the contents of the image field?

At first, none of the images were loading at all from Finder. My last comment, I was really surprised because some (not all) of the images loaded. Right now, I’m still getting the error message “The file “paste-6c9bd328bba675e5c51a4262ba8cee2f37f2aa32.jpg” could not be opened. It may be damaged or use a file format that Preview doesn’t recognize.”

This is the content of the image field:

Thanks!

Okay. If the image files truly are corrupt or damaged according to Finder, then that explains why they aren’t working in Anki.

We should probably figure out why your media files got corrupted and how to prevent it from happening again in the future.

If you have non-corrupted copies of the image files, you should be able to just copy them into the collection.media folder to replace the corrupted ones. But, if there is something that is causing the corruption and it happens again, then you’ll just have the same problem in the future.

When you were redownloading the deck as different users, do you mean you were logging into your Mac as different users? Or, did you mean that you were creating and using different Anki profiles?

When you said that you were “syncing it to my email account”, did you mean that you were syncing your Anki profile to ankiweb.net? Or, did you mean something else?

Do you have just one account on ankiweb.net? Or, do you have multiple accounts?

If you have multiple Anki profiles but a single ankiweb.net account, were you syncing your multiple profiles to the same ankiweb.net account?

Are you syncing the files on your computer with a third-party service like DropBox?

Not sure if this is related! But I tried importing a deck from Quizlet just now (I use the add-on; and yes, I have tried starting Anki disabling add-ons for my previous issue), and it didn’t work. I deleted and re-added the add-on (code: 1362209126) and tried again, and I received the same message. It’s really long, but here is the beginning of it:

Expecting value: line 1 column 1 (char 0)
-----------------
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Captcha Challenge…</title>
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link rel="icon" type="image/png" sizes="16x16" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9h

To note, some (maybe 5?) of the cards in the Quizlet deck have images!

I believe something is causing the corruption, as I have tried copying the non-corrupted image files into the collection.media folder, which doesn’t work.

I was re-importing the deck onto different Anki profiles. I was syncing to my Anki profile on ankiweb.net, and that is my only account (it removed all of my other decks but I back-saved them).

I am not syncing the files on my computer with a third-party service.

If you were using multiple Anki profiles with the same Anki account, it is possible that something like this happened:

  1. profile1 has corrupt images
  2. profile1 syncs to ankiweb, so ankiweb now has corrupt images
  3. profile2 created with good images
  4. profile2 syncs to ankiweb in download mode, so the ankiweb corrupted images are downloaded to profile2, so profile2 now has corrupt images
  5. profile3 created with good images
  6. good images copied from profile3 to profile2, so profile2 now has good images
  7. profile2 syncs to ankiweb in download mode, so profile2 now has corrupted images

If you think that might be the issue, you might want to try:

  1. Anki Preferences → Syncing → Synchronization → On next sync force changes in one direction
  2. Copy the good image files into collection.media
  3. Sync, this time forcing an upload to ankiweb

Or, try:

  1. Anki Preferences → Syncing → AnkiWeb Account → Log Out (so syncing is now disabled)
  2. Then try copying the good image files into collection.media
  3. Then test using Anki for a day or so to see if the image files remain uncorrupted.
  4. (But, if this fixes things, eventually you’ll still probably want to re-add the AnkiWeb account and do an initial force upload sync.)

Some things have worked! I did your first set of steps and most images work – they haven’t been corrupted in my Finder (yet). However, a few still don’t work. I checked one, and followed the directions you said in the 4th comment of this thread: I opened the file in Finder just fine, then toggled the HTML Editor for the image field, and found the code to be exactly as it should be, with the only difference being a <br> before the line of code (though taking that out also doesn’t change the image loading) (apologies if that is a non-important observation; I don’t code!). However, when I click the image icon that is in the display of the card (where the real file should be), and have it direct me to that image in Finder, it opens just fine.

Also, when I tried importing the other deck I was trying from Quizlet, I still get the same error message.

Thanks in advance!

I’m glad that things are improving for you.

For the image files that still don’t load/appear in Anki but are not actually corrupt because they can be viewed just fine in the Finder, how many of these files are there?

If there aren’t too many of them, you might want to try re-adding the images to the Anki notes. Or, make copies of the problem image files, giving them slightly different filenames, and then add the new/copied images to the notes, deleting the old/broken ones.

Thank you so much! I had to make copies, give them different filename, then add the new images to the cards, and it worked. There were less than 10 that needed fixing, so it wasn’t too bad.

With regards to the Quizlet issue, should I open a new thread for that?

1 Like

Nevermind, my Quizlet actually works now!

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