Anki is unable to display any SVG images on my computer

Anki(Version ⁨2.1.65 (aa9a734f)⁩) is unable to display any SVG images on my computer, but it works normally on another computer. Can someone help me find the reason?


Maybe try running Tools > Check Media and restarting Anki.

If it doesn’t help, maybe try installing the latest Anki version (2.1.66rc1) from https://github.com/ankitects/anki/releases

Thanks for your reply, I will try it later. Then I found out that online SVG can display normally
image

That sounds like the images are not synced.

https://faqs.ankiweb.net/media-files-may-take-time-to-sync.html

It’s not related to whether the picture is synchronized or not, the SVG files are all in the collection.media directory, If you want to reproduce the problem, you can try modifying the content of one of the SVG files in a windows PC that displays the Svg image normally, which will cause all SVG files to not display properly unless you reinstall the operate system.


I have updated the Anki version, but it still cannot solve the problem :disappointed:

I don’t know what’s the issue. The svg files works fine for me.

If Tools > Check Media doesn’t report it as missing, maybe install AnkiWebView Inspector, open the Network tab, disable cache and open or reload the card (ss or go to the deck screen and back). If everything is okay, the Status code should be 200 and the Type should be svg+xml

Maybe open the svg file with Inskape, save it as a different svg file with a different filename and try adding it to Anki instead.

Tools>Check Media doen’t report it as missing


I open the Network tab,disable cache and reload the card, then I see the status code is 200 but type is text/plain not svg+xml, how can I fix it?

Maybe it’s not a valid svg file.

Could you open ‘arrow.svg’ with the text editor and paste the content using a new line and the </> button (as preformatted text)? It should look like this. Or upload it on https://gofile.io/?

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" x="0px" y="0px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"><polyline fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" points="12.5,21 3.5,12 12.5,3 "></polyline><line fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" x1="22" y1="12" x2="3.5" y2="12"></line></svg>

This is the source code of arrow.svg.

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_2_1_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
<polygon style="fill:#FFFFFE;stroke:#000001;stroke-miterlimit:10;" points="12.73606,19.04075 7.80159,19.04075 9.82813,14.91828 
	6.88341,13.42515 4.62301,18.05872 1.26394,14.78295 1.26394,30.57485 "/>
</svg>

I upload the file and the donwload link is Gofile - Free Unlimited File Sharing and Storage
And I think it is a valid svg file because when I restore to the operating system state before modifying a SVG file (not this file), the file can be displayed as an image normally

No idea. It displays correctly for me on Windows and the returned type is set correctly to svg+xml. I don’t have any add-ons enabled.

Maybe the mime type for .svg is set incorrectly in the registry. It displays broken for me too if it set it to plain/text.

  1. Open the Start menu and type regedit to open Registry Editor
  2. In the address bar paste Computer\HKEY_CLASSES_ROOT\.svg and press Enter to quickly go to it.
  3. If the Content Type is set to text/plain, set it to image/svg+xml
  4. Restart Anki.

2 Likes

You are right. When I followed your instructions to modify the registry and restart Anki, the problem was resolved. Thanks very much.

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