Quick, define stroke order diagram. Stroke Order Diagram (SOD): a picture guide used to learn how to write kanji. Okay you’ve seen that before even in the most basic beginner textbook. But wait, don’t get bored just yet, one more definition for you. Colorful Stroke Order Diagram (CSOD): a colorful picture guide used to learn how to write kanji . . . and be awesome.
As I started to think about this topic, I realized that what I had originally done to get CSODs into my own deck wasn’t what I wanted to tell you to do. I tried to figure out what could be done to avoid certain problems that I have faced using them and the issues behind CSODs grew into a horrible monster. I was ready to throw out the whole post, but instead I was motivated to do something better: defeat this monster, take its loot, and create a better way to make CSODs.
(Update 5/7/2013): This post outlines how to configure the CSODs for Anki 1. With Anki 2, it is much simpler. You download the easy to use shared plugin here.
Why use stroke order diagrams?
Adshap doesn’t like writing. But after looking at these, even he thinks they can provide a nice little (colorful) punch to your RTK mod deck kanji. I don’t think learning perfect stroke order is necessary. But I do think studying it can be helpful; thinking about it is an additional way to engage with the kanji and can make the pieces easier to remember, good stroke order habits can make you more understandable to handwriting recognition software, and it can make your handwriting easier to read if you write sloppily. Or you can just use them as eye candy on your kanji cards.
The diagrams
I’ve written a script to color the strokes and stroke numbers in KanjiVG files (which are free to use and share under the Creative Commons Attribution-Share Alike 3.0 license), resize them, and rename them so that they can be dropped into an anki deck. I used it to create two sets of SVGs that you can use to very easily add CSODs to all of your kanji cards. One colors the strokes in rainbow order, which is nice because you can see at a glance how the kanji is put together but has the disadvantage that stokes next to each other are similar colors, and color is sometimes necessary to tell which number goes with which stroke.
The other maximizes the contrast between any set of consecutive strokes. (This uses the magical golden ratio, which is math hard at work to make your life better.)
You can click any of those to see the the size these are on cards.
How to add them to all of your kanji cards
- Download the collection of your choice: spectrum or contrast.
- Unzip it and put the contents in your deck’s .media folder (which is most likely in your Dropbox/Public/Anki folder if you sync media or next to your deck at [My ]Documents/Anki)
- Add <img src={{text:Kanji}}.svg> to your card template, where Kanji is the name of a field that contains a single kanji character.
- Close and reopen your deck.
- If you aren’t going to be adding any more kanji to your deck and you’d like to delete all the extra files, you can run “Tools >> Advanced >> Check Media Database…” and select “scan and delete”. If you do this and want to add more kanji later, you will have to repeat the above steps again.
A font to match
Want a font that writes characters the same way CSODs do? Go to this Epson Japan font page, download the file and install the fonts, and use “EPSON 教科書体M” or more likely “EPSON ã≥â»èëëÃÇl” depending on how your computer interpreted the pre-unicode font names (this is in the epkyouka.ttf file, but the other fonts are nice too so I recommend installing them all.) This is a font in the family used for elementary school textbooks because the shape is similar to the calligraphy taught in school. Want this to work in AnkiMobile? See Embedding Fonts.
Go Forth
Don’t blame me if your hand starts getting a workout from all this writing bliss. You can even work on your inner monologue and count in Japanese as you write out the strokes. Let me know what you think of these CSODs. Is there any way you would like me to improve them? If you provide some insightful info, I may change them just for you. Really.
—————————————————
Written by: Cayenne
Related posts:
Cayenne
Latest posts by Cayenne (see all)
- Embracing the Neverending Dictionary Dive - 03/19/2013
- Fighting Easier Dictionary-Monsters - 03/03/2013
- Anki Of The Future - 08/26/2012









I’m having some trouble getting this to work.
The actual images in the folder are .svg files so I tried changing the image link to but I still get the missing image picture in Anki. Can Anki open that type of file? Is there a place to download the pictures in .png format?
Thanks!
P.S. This is very awesome. :P Thanks for posting about it!
That was a typo on my part! I should have said .svg instead of .png. I’ll ask Adshap to fix that. Sorry for the bad proofreading on my part.
Also: If people want I can upload PNGs as well, but SVGs are significantly smaller and should be supported by any anki use except ankiweb in an old browser.
Thanks for pointing out the problem. And I’m glad to hear you like them.
Ack, I’m not reading… usually I sit on comments for a bit to make sure I’m saying correct things. You said you changed the link. Did you copy and paste rather than typing? I see that wordpress changed my quotation marks to styled ones; they’re not actually necessary so it’s probably better to just remove them. And the third thing to try is the media check even though I remember that just being necessary at the syncing point in the process, but I don’t understand all the technical details behind why this works so I’m not certain that should be the case.
I’ve tried everything you’ve suggested up to this point, and I’m still unable to get this to work.
I’m looking forward to being able to try it out on my cards though.
One thing I’ve noticed is that there are files with names like 繧ア繧・svg instead of 繧ア繧.svg — In addition to it, I don’t have anything in my kanji field that would match up with most of these files either.
But I’m not quite sure how this is supposed to work, so it may have been done like that intentionally.
Yeah, it only works with kanji fields that contain exactly one character.
Ah, my kanji fields are the default ones, so they just contain one character.
蜈ョ.svg – I just mean that the files are named like this, so it seems like they won’t be picked up by looking for the kanji name then appending .svg to it.
Also, I just looked in the zip file itself and it has lots of items with the same name, so they overwrite each other when they’re being extracted. Maybe it is an issue of the names getting corrupted in the zip file or perhaps them not working for people on other platforms.
They’re being read as svg documents when they’re in the zip folder, but then as extensionless files when I extract them as they are named with a ・ instead of a . and my system won’t accept ・s for that purpose.
This is how it appears for me by the way: http://i.imgur.com/rlEPX.png
Hopefully some of this proved useful anyway.
I tried it again and it worked! Not sure what was different this time, but it worked with the .svg extension.
What program are you using to unzip them?
I used winrar.
Had to reply here as it seems I can’t reply that deeply.
Make sure you have the lastest version. If that doesn’t work, try a different application. If you do get something to work, that could be useful to other people.
Ah, I tried a few other programs, and they gave the same issue.
However, since you created the archive on a mac, I decided to use stuffit, and that worked. So for anyone else experiencing the wrong file name issue, try using stuffit to extract the .zip file.
Ah, thanks. I’ll try zipping them up in linux instead. But I’m moving this week so I don’t know when I’ll get to it.
Wait… you say the file names are coming out that way? In the unzipped directory? That’s odd. I have tested downloading and unzipping the files and they did come out right (the filename should be a single character followed by .svg except for some variants that will have a dash and the name of the variant after the character (that is because these came in the original data and I chose not to bother to throw them away; they don’t do anything for the automatic anki adding.)
No worries :P
So the weird thing now is that I’ve gotten the links to work within the deck so the pictures show up on the desktop client, but all of the strokes are behind the background color I have (with the stroke number showing through fine).
Also, no matter what I do I can’t get the pictures to work on Anki mobile. I’ve checked the media database a bunch of times and checked the database as well but they still won’t come up.
Interesting bug with the strokes hiding behind the background. I was able to reproduce it for some card template settings but haven’t figured out the precise pattern yet. Would you mind sharing your card template? And do you have it set to hide the question when showing the answer?
With the AnkiMobile syncing, are other decks’ media syncing properly? Has dropbox had time to upload the 10,000 files you just dropped in it?
What would be the easiest way to share the template? Right now I have the answer field as only the link to the picture. I don’t have it set to hide the question when showing the answer.
One thing I was just messing with was that the picture isn’t behind the background if I remove one set of curly brackets around text:Kanji. Will that have any negative effects? Unfortunately it still isn’t working on Anki mobile. The pictures actually all synced to my phone on the last sync but they don’t show up on the cards.
Thanks for taking the time to help!
And I forgot to mention that other decks have media that work fine.
Ah hah.
You’re right, it needs to be {{text:Kanji}}. Using triple braces is another way to prevent formatting and they have weird interactions with how other things in the expression.
Thank you for being such a good bug reporter.
I’m makin lots of test decks and syncing them to AnkiMobile and sometimes they work and sometimes they don’t.
So far, they’ve always worked if I’ve gotten them set up so that they are working on the desktop, checked the media database, then done at least one review, and then synced everything. And sometimes worked without doing all those things. Are you finding they’re not working even with doing all of that?
So I’ve tried a bunch of times and I still can’t get it to work. Are you syncing to an iPhone or a different type of phone?
Any chance you could upload the png files? I posted this problem on the Anki Help boards and the response was that AnkiMobile might not support the svg file type?
This is working for me on an iPhone 4 running iOS 5.1, though it seems so quirky about what it takes to get it to start working that I’m not entirely sure what the necessary sequence of steps is. I’ve been syncing via Dropbox and AnkiWeb; you could also try the via iTunes method.
I just remembered I’m running a beta version of AnkiMobile… I think the beta was just supposed to be bugfixes rather than adding new features though.
I will upload PNGs, though it might not be until next weekend.
I’ve uploaded PNG sets. Let me know if this fixes the problem.
Thanks! Have they been uploaded on this site? When I use the links in this post I still get the .svg files.
https://github.com/cayennes/kanji-colorize/downloads
I just realized I never responded to this. Sorry!
Unfortunately I still couldn’t get the PNGs to work so it must just be a problem with my deck. No worries though. Thanks again for all your help!
I think what could be even more helpful are diagrams which color-code (and possibly identify) at-a-glance the radicals which make up a character. Anyone wanna take a crack at it?
KanjiVG includes component data so that is doable.
Have you seen Tagaini Jisho?
Thanks, Cayenne! I’ll check it out, looks like a really great tool.
I got this to work (mostly) with Anki syncing via dropbox, but I have a strange problem with it. On my mac the contrast stroke order image shows up only as the numbers until I try and click on the image, then the entire image is visible as it should be. I have no idea why it does that. I haven’t tried it out via mobile yet to see if I have the same issue. Has anyone else experience this? Is it fixable or should I just start playing connect the kanji dots? That’s one way to spice up RTK…
That seems to have something to do with how these SVGs interact with Anki’s SVG display. I have experienced it when the whole diagram isn’t scrolled into view, and with some templates regardless of that. With those I have found that adding ” ” before the img tag fixes it.
If it’s still an issue, when I upload the PNGs they won’t have this problem.
that empty space was supposed to be
Trying again:
The non breaking space worked. Yay! Thanks. :)
Can this be turned into animated gifs? I think that animated kanjis or frames like in jisho.org could be better.
This is just a thought I had, but I think gifs might be ultimately harmful, at least past a certain point. The reason is that as you get better you start going through your cards reasonably fast, and when you do have doubts about stroke order they’re usual very specific and clear points (usually about something like two strokes that cross each other but for which is not clear which is drawn first, or which of two parts of the kanji are drawn first), and having to wait for a gif file to run when you just want to check a single specific point might just end up being aggravating. (and, on another note, it would also be harder to harmonize with ankimobile, if you use it)
I don’t mean to argue — I’m sure it could be better for many people like that; personally, I like it how it is. It just takes one quick glance and I can tell exactly how it is written rather than following along or waiting for an animation.
Personally I prefer non-animated for the same reasons that other people posted. But I understand that different people learn differently and I can see that for some people the initial learning process would be enhanced by watching an animation.
Translating SVGs into other image types in a cross-platform way on python is a bit tricky, but it would also be possible to animate the SVGs using Anki’s JavaScript support – and something interactive like that could also have a way to skip to the end when you’re past that initial stage. Unfortunately I’m really busy at the moment and it’s not a priority for me, but I’ll consider it.
You might consider one of the methods of creating automatic links to web pages and visiting the Jisho.org page for your kanji and watching their animation any time you fail a card and feel like you’d like to see it animated.
This has made a great addition to my RTK deck. Thanks! However, I am using the sixth edition of RTK, and so I have recently stumbled into a few problems. The kanji 嗅 (keyword ‘sniff’, Heisig no. 129/3008) is missing, and I suspect so are the other 175 new additions to the book. I would like to add these missing kanji to my deck, but I was unable to get your script to work, possibly because I am using Python 2.6.1? Anyway, could you please suggest a possible solution to my problem?
I just double checked, and that is included, so there’s some issue with your deck. (Could you have a space as well as a character on the card? Did you delete unused media before adding that card?)
The addon for anki 2.0 should work a lot more smoothly, so I’m looking forward to 2.0 going stable.
I do apologise. The kanji is there, my Anki implementation must have deleted the unused media for some reason. By the by, I have noticed an error in the sixth edition relating to that kanji. (Just from my close inspection of it this afternoon). It appears that in the book, the kanji is missing the final stroke (the one the turns the 大 into 犬). Also, what do you know about Anki 2.0?
Announcements relating to anki 2.0 are posted on the anki users google group; the sticky thread at the top has a download link for the latest beta. An overview of changes can be found at http://ankisrs.net/docs/dev/changes.html .
Thank you very much! After a lot of messing around, I finally got it to work on ankimobile 1.8.
For it to work on ankimobile (not sure if this has changed in the new ankimobile as I haven’t yet upgraded) double quote marks are required:
<img src=”{{text:Kanji}}.svg” />
(Note the added double quotes around the filename.)
Without these the images just won’t show on ankimobile.
Hm, I’m having pretty shoddy luck trying to extract these files on Windows. It looks like the files were given Unicode names, but any program I use on Windows – the shell default, 7-zip, or WinZip – all interpret them as ASCII and refuse to extract some of the files because they appear to have characters that are invalid in windows filepaths (like ‘:’).
Luckily, I do have W7 Enterprise, so I’m currently installing the Japanese language pack to see if that helps…
Hi – this post is outdated. Get the anki2 addon at https://ankiweb.net/shared/info/1964372878 .
Ah, thanks. I’ll go get that.
Btw, my problem turned out to be a rather silly thing anyways. It turns out the offending file WAS supposed to be named “:.svg”, because it actually is a glyph of a colon. :P
Just changed from the somewhat troublesome implementation of stroke order diagrams in Anki 1 to the Anki 2 addon implementation, and it totally blows the previous version out of the water (including on how sweet looking the diagrams end up being).
The one critique I have is that you really should publicize it more on this site (it totally should be mentioned somewhere one the post above, if not even get it’s own post). I was pretty much lucky to find it before I tried to painstakingly address the problem I had one kanji at a time…
Thanks for the info. I added an update to the top of the post. If Cayenne or any anyone on this site is interested in writing about the new version of this for Anki 2, I’d be happy to put it up.
Hey guys, I’m just about to embark on my Japanese journey so I downloaded Anki and got ready to start. However, once I discovered that I could add a stroke order add-on such as this, I immediately tried to figure out how. I have downloaded the Kanji Colorer into Anki, but after this I have no idea what to do. I am not tech savvy at all and I am extremely confused by the directions on the shared plug in at (https://ankiweb.net/shared/info/1964372878). I also have a Mac if that helps. I guess what confuses me is in the directions when it says “Add a “Diagram” field to a model with “Japanese” in the name and a field named “Kanji”.” I don’t know how to go about doing this at all.
Is there anyway someone could please give me an extremely basic description of what to do, or suggest something else that I can do. Sorry about the hassle and thank-you in advance.
I had trouble with this too.
You need to rename the note type (“tools” > “note types”) of the card and add “Japanese” (ex: from “Heisig” to “Heisig Japanese”). Then add to that card type a field labeld “Diagram” (and don’t forget to add it to the back of the card, too).
Then (re)genrate all the cards from the “tools” menu, and it should work.