An Excalidraw script for creating Anki image occlusion cards in Obsidian, similar to Anki's Image Occlusion Enhanced add-on but integrated into your Obsidian workflow.
This script allows you to create image occlusion flashcards directly in Obsidian using Excalidraw. It's designed to work seamlessly with your existing note-taking workflow while providing similar functionality to Anki's Image Occlusion Enhanced.
-
Integrated Workflow
- Create cards directly in Obsidian
- Use Excalidraw's drawing tools
- Keep source files with your notes
- Edit cards without leaving Obsidian
-
Enhanced Features
- Supports shape grouping
- Maintains source file links
- Batch operations for card management
- Better file organization
-
Version Control
- All files are plain text/images
- Easy to backup and sync
- Works with git and other VCS
-
Editing Experience
- No real-time preview of occlusions
- Must regenerate cards after edits
- Cannot edit existing cards directly
-
Card Types
- Only supports "Hide One" and "Hide All" modes
- No support for "Hide All, Guess One by One"
- Cannot mix different occlusion types in one card
-
Performance
- Generating multiple cards takes longer
- Manual sync with Anki required
- Larger file size due to image storage
- Creating anatomy flashcards
- Learning diagrams and charts
- Memorizing maps and locations
- Studying technical illustrations
- Learning character components
-
Install required Obsidian plugins:
- Excalidraw
- Templater
- Obsidian to Anki
-
Copy template files to your templates folder:
templates/ ├── Anki Card.md # For image occlusion cards
- Open or create an Excalidraw file
- Insert an image you want to study ( Scenes including directly inserting images into the canvas of excalidraw; inserting another excaldraw as an image; cropping a work of excaldraw and displaying a portion of the image before inserting it as an image into the excalidraw canvas.)
- Draw shapes over areas you want to occlude:
- Use rectangles or ellipses
- Group related shapes if needed
- Position shapes precisely over target areas
- Select both the image and all shapes you want to use as masks
- Run the "Image Occlusion" script
- Choose occlusion mode:
⭐ Add Cards: Hide One, Guess One
- Creates one card per mask
- Only one area is hidden at a time
⭐⭐ Add Cards: Hide All, Guess One
- Creates cards where all areas are hidden except one
- Tests recognition of individual items
-
To mark cards for deletion:
- Select source Excalidraw file
- Run "Image Occlusion" script
- Choose
🗑️ Delete Cards: Delete all old cards
- This adds DELETE marker before Anki card IDs
- Sync with Anki to remove cards
-
To permanently delete files:
- Select source Excalidraw file
- Run "Image Occlusion" script
- Choose
🗑️💥 Delete Cards: Delete all old cards file and related images
- Confirm deletion
- This removes:
- All related card files
- Generated images
- Batch marker files
Excalidraw-Image-Occlusions/
└── excalidraw-name-timestamp/
├── batch-marker.md # Links to source file
├── q-timestamp.png # Question images
├── a-timestamp.png # Answer images
└── timestamp.card.md # Card files
- Draw precise masks around areas you want to study
- Use meaningful names for your Excalidraw files
- Group related shapes when they form a logical unit
- Review generated cards in Anki before bulk deletion
- Keep your source Excalidraw files organized
- If cards don't appear in Anki:
- Check Obsidian to Anki plugin settings
- Verify card template format
- Ensure proper sync with Anki
- If images don't display correctly:
- Check file paths in card markdown
- Verify image files exist in correct location
- For deletion issues:
- Ensure you're selecting the correct source file
- Check if files are properly linked
-
Always Backup Your Data
- Backup your vault before using deletion features
- Keep copies of important Excalidraw files
- Export your Anki deck regularly
-
Deletion Risks
Delete Cards: Delete all old cards file and related images
is IRREVERSIBLE- This operation will:
- Permanently delete all card files
- Remove entire image folders
- Delete batch marker files
- No way to recover deleted files without backup
-
Safe Deletion Practice
- Use
Delete Cards: Delete all old cards (only add DELETE marker)
first - Review marked cards in Anki
- Sync with Anki to verify deletion
- Only then consider using permanent deletion
- Use
-
Before Using Permanent Deletion
- Double check selected source file
- Verify which cards will be affected
- Ensure you have backups
- Consider using Obsidian's file recovery if available
- Wait for Anki sync to complete
-
Regular Backups
- Daily: Obsidian vault backup - Weekly: Anki deck export - Monthly: Full system backup
-
Safe Deletion Process
1. Mark cards for deletion 2. Review in Anki 3. Sync with Anki 4. Verify deletion 5. Backup vault 6. Run permanent deletion
-
Recovery Options
- Keep backups for at least 30 days
- Use version control if possible
- Document your deletion operations
- Test backup restoration periodically