Exporting from Anki, but how to handle images?

I’m a total newbie and perhaps a bit ahead of myself. But thought I would ask if there is a simple solution after I read a lot of what I don’t understand yet in this similar thread.

My simple workflow is to annotate PDFs with anchored notes with Skim. Using Hook, I include a deep link to that same spot. I then manually copy each of those annotations into Anki, with the hook link, sometimes adding screen shots of textbook diagrams. Once the Anki reviews material has settled and began to structure itself in my mind, I export Anki notes as a Tab delimited file and drop it in TB. I find making mind maps much quicker with this mental understanding first.

On export to tab delimited from Anki, of course the actual image from the Anki note is missing. Anki does include some html (I think) in that field (e.g. “<img src=”“paste-3b761a5a8961c6eaa25b3c674b2fade5d521d4b9.jpg”“>”). I looked up that Anki actually stores all media in a folder in the Anki application support folder.

Extrapolating how versatile and powerful TB is, I image a wonderful world where I’m not needing to copy and paste those images from Anki to TB. Perhaps there is a way TB can reference Anki’s media folder? Maybe there is a way to copy the media in Anki’s folder to somewhere TB can access? How could all this get linked so TB is pulling existing images or referencing them into notes?

Sorry if this is a very naive question from a new guy. That being said, maybe I need more experience with TB to understand a highly technical answer. At the very least, hope it inspires others’ workflows!

It looks like Anki keeps images at a path like:

~/Library/Application Support/Anki2/[username]/collection.media/

So your image paste-3b761a5a8961c6eaa25b3c674b2fade5d521d4b9.jpg can be accessed at:

~/Library/Application Support/Anki2/[username]/collection.media/paste-3b761a5a8961c6eaa25b3c674b2fade5d521d4b9.jpg

Make a new Tinderbox note, and make the system attribute File a Displayed Attribute (see how). Then paste the above path in as the value of $File. Then, click the folder icon in the File row of the Displayed Attributes table. If you have got the path correct, a Finder window will open showing the image.

So, now TBX doc and image are connected, so to speak.

If the sequence <img src="....jpg"> occurs in exported Anki data with images, then Tinderbox should be to recover the filename. Note: you will need to do some testing, e.g. are all images JPGs or are there other types there too. It looks like—not tested—the regex pattern '<img src=\"[^\"}+\">' should be able to locate the image’s filename in the imported data.

Next, whilst you can paste images into a Note’s text. Whether you should just add loads of images to notes merits thought. Are these images key to the task or only illustrative? If the, I’d leave them accessible to the note via the means above. Why? Tinderbox notes weren’t designed from outset as multimedia spaces as the app is essentially a text annotation/analysis tool. To store the image in the TBX involves storing the image info in the note text in a form that adds bloat to the file size. no big deal if you expect that outcome. But, if adding files, I’d suggest processing them so they are no larger/higher res than needed in app. The is an outstanding feature request to allow in app use of externally stored images.

Does that help?

†. This too is not without problems for the general use as it falls to the user to not move the images from their OS stored location, and not everyone is that organised. No blame there, but acceptance of real vs idealised human behaviour. :slight_smile:

1 Like

This is just amazing @mwra

1 Like

Thanks! This makes sense and is a very clear explanation. I’ll need to play with it this weekend. Everything takes me 3x as long as a newbie. :slight_smile:

Something I just thought of: would it be easier/more logical to capture notes in TB first then export to Anki? I think a CSV would be that route. Just not sure how to export from TB yet.

I’m really struggling conceptually. A lot of answers are “it depends”. So far I think Skim, TB, DEVONThink, Anki, and Zotero are all involved.

Perhaps I’m making it too complex.

Yeah probably :slight_smile: Fun to geek out, albeit!

There are a host of ways to export from Tinderbox and it is very flexible. Unlike many apps, it isn’t a ‘canned’ push-button feature, as you define what is exported. WE can help with that.

The make test manageable, I’d make a small CSV file in BBEdit or such and do some practice imports to Anki. that way you’ll know what the export template needs. When you’ve firmer detail, the forum can help.

Hey there, what exactly is Anki? What is it intended to do?

For, I struggle keeping images in an apps ~/library/… directory. This seems inherently dangerous as it is difficult to back these images up and manage them or use them in another contexts. As noted in many of my videos, I recommend, as Mark points out, having a folder with your images (one I backup with Arq). For maximum flexibility, I parse the path for an image into three parts ($MediaPath, $MediaDir, $MediaFileName) and use a config note (e.g. TBXConig) and local values to manage the display of the image. I have a function that populates the $Hover and $Fill attributes so that I can see the images in map view and on hover. I find this method ideal as I can visually see the image in map view, preview the image, hover a note to see the images, and most importantly export the image to HTML, Word, PDFs, PPTs, etc. I can also have the paths and image file names sent to CVS and excel. Moreover, with this method, I can ass other HTML tags to the image src, e.g. alt, height, width, and align. I can also use markdown to insert images into notes. For anyone interested, I’ll be happy to explain all of this in more detail, or you can simply watch some of my earlier videos.

As I typically have reference 10s if not hundreds of images in my files, loading them in Text is a non-starter. TBX files get too big and the images can’t be exported.

My longstanding request is that the $Fill attribute would support a user-generated path, like $Hover.

1 Like

This would be very useful!

1 Like

Anki is a free, cross-platform, open source, app for doing flash cards for learning. As they describe it (see link):

Anki is a program which makes remembering things easy. Because it’s a lot more efficient than traditional study methods, you can either greatly decrease your time spent studying, or greatly increase the amount you learn.

Anyone who needs to remember things in their daily life can benefit from Anki. Since it is content-agnostic and supports images, audio, videos and scientific markup (via LaTeX), the possibilities are endless.

1 Like

Like others mentioned, Anki is a free and open source spaced repetition software. It is the absolute legacy gold standard for serious students and knowledge workers.

A little background. Medical, MBA, and undergrad students use it religiously and daily to internalize information. Many produce flashcards as they study by copying and pasting from pdfs and notes. This information isn’t linked in a coherent way until their own mental map is formed through repetition.

Separately, these same students also use bi-directional notes apps like Obsidian, Roam, Craft, Notion, etc. for linking their thinking. These apps add-on developers are understanding students use both tools, and that they value the ability to export their notes from a bi-directional notes app into Anki.

When studying cards, it’s very useful to tap a link in the flashcard to go back to your mind map to better understand a concept and surrounding information. Basically learning is on fire in this scenario.

This ability exists with Obsidian through very clunky add-ons. However, Obsidian’s map is lacking a real ability to visually map notes that retain their spatial distance and orientation from each other.

If Tinderbox could simply export a CSV with Title, Note, and selected attributes, without a learning curve to do it, they would export it directly into Anki (has import CSV and HTML functions). I think you would see some serious conversions. Fundamentally the Obsidian type of user values keeping their information local and highly transferable.

…which you don’t define which make it hard to help writing export templates. I think you just shifted the learning curve :wink:

Seriously, if you give a list of attributes you need to export it’s trivial to write a pair of templates to let you easily export a container of notes (i.e. a container note or an agent).

A reason Tinderbox does do 'one button export is most people actually want—for real work as opposed to demos—different exported content. IOW, they need different templates. So, Tinderbox’s method is the user writes their own templates. The forum can help but ask for what you need to do. Reference to “Obsidian, Roam, Craft, Notion, etc.” isn’t much of a help as not everyone uses/knows those apps.

HTH :slight_smile:

I understand. The way it is setup is really super powerful, and I’m certainly not in a position to make a product development suggestions (for multiple reasons!).

I’ve watched many of Michael’s amazing videos and lessons to try to get up to speed on the concepts, while balancing the MBA studying! I saw the ability to export to HTML, but not CSV.

I’ve done a fair amount of searching, but would you be kind enough to point me to material on how to export to a CSV? That’s really all that we would really need to import into Anki.

Happy to do put in the learning, just a little lost on how where to start with CSV.

Thank you much!

The ‘HTML’ export is just the default formatting, because it is the most useful general interchange format. But the export is only HTML because that’s how the templates are configured.

IOW, the templates export what you code them to export.

Have you read this article, which explains the basics? It is as simple as that. Of course, you need to decide what Tinderbox attributes you wish to export.

i think notions of ‘standards’ for interchange as in most cases they turn out to be “the only format [some other app] accepts”. That’s fine but it isn’t a standard and thus leads to confusion. Also, many like interchange formats like CSV, Markdown and OPML to name but a few have many incompatible flavours of the same base format, leading to incorrect assumptions about failed import/export rather than a failure to correctly encode for the right flavour. Sadly many apps have really awful documentation of their import/export interface, and Tinderbox gets blamed because it turns out the ‘standard’ they use isn’t actually the standard. <sigh>.

Depending on the attributes you want you may need to do additional transforms of the source data. A case in point is Date-type data.

My suggestion is to start by using the templates above - remember to make the two user attributes of the name and data type specified. This will let you see how the system works. Actually, I’ve made a basic test bed for you: csv-export-intro.tbx (121.9 KB)

The TBX includes both CSV and Tab-delim examples as in the linked article. I have supplied a container “Test data” and an agent “test agent” that finds the contents of the test container. Both are set to use CSV export.

To view data without exporting, select either the container or the agent and then click the ‘Export’ tab at the top of the text pane. Do not use the preview tab as this is only designed for styled content like HTML. The result is test data like this:

This also shows the point that you might want to add extra formatted, for instance giving the final cost as “£21.15” and not “21.15”. The exact currency symbol you use (or don’t!) is the sort of choice you the user of the template make according to your exact needs. (This also reflects the point there there is no one size-fits-all-solution)

To export the data, select either the text container or agent and use File menu ▸ Export Selected Note and then save the resulting CSV file wherever you want.

I’ll not describe trying use of the specimen tab-delim containers so this does get too complex. We can circle back if needed.

OK, now you have a working example. Next, make a list of the attribute you actually want to export for your own project. As you’re new to the process, I’d suggest posting here a list of each attribute’s:

  • name
  • data-type
  • example of how you want the data to look (e.g. date formats, etc.)

… listed in order of the columns you wish to create. We can then advise if you need extra help doing that.

It’s as simple as that - indeed much simpler than the amount of text needed to describe it. :slight_smile:

With the attribute browser, this is a trivial exercise in Tinderbox.

  1. Open the Attribute browser
  2. Run a query to get the notes you want to see
  3. Rt. Click along the white band where it says “Name”, add your desired attributes
  4. Select File Export as Attribute browser (this will export a .rtf file).
  5. If needed, convert the .RTF file to a .txt file (you can due this by selecting “Plain Text” if you’re using the built-in macOS text editor

Now you have a CSV file can import in nearly anything. I do it all the time.

Also, I suspect if we could find a way to automate the publishing of notes into Anki, perhaps AppleScript (which it does not seem to support), hazel, keyboard maestro, etc. I’m pretty sure there is a way.