This project converts existing physical or digital cue cards into Anki cue cards by performing OCR on paired question/answer images and generating a .csv
for Anki import.
git clone https://github.com/91-9/ocr-anki
cd ocr-anki
pip install google-cloud-vision
- Python 3.7+ required
- Google Cloud Vision API enabled
-
Create a project
Google Cloud Console -
Enable the Vision API
Enable Vision API -
Create a Service Account with Editor role
Service Accounts -
Generate a JSON Key file and download it
-
Set environment variable:
- PowerShell:
$env:GOOGLE_APPLICATION_CREDENTIALS="C:\Path\To\key.json"
- Command Prompt:
set GOOGLE_APPLICATION_CREDENTIALS=C:\Path\To\key.json
- PowerShell:
- Take photos or scans of your cue cards (question and answer sides).
- Filenames must reflect the date and time the images were taken, so that their order matches the intended question > answer sequence (e.g.,
20250608_120101.jpg
,20250608_120105.jpg
, ...). - Ensure images are in time sequence: question image, then answer image, then next question, then next answer, etc.
- Run the script:
python ocr_google_vision.py
Generates ocr_output.csv
:
Question 1 text, Answer 1 text
Question 2 text, Answer 2 text
Tags or prefixes like 8)
or general)
are stripped from the question text.
- In Anki, go to File → Import
- Select
ocr_output.csv
- Choose:
- Field 1 → Front
- Field 2 → Back
- Separator: Comma
- Encoding: UTF-8
- The script assumes each question-answer pair is two consecutive images in time order.
- Filenames must reflect the date/time to ensure correct sequence.
- Supported image extensions:
.jpg
,.jpeg
,.png
. - Output does not include tags or headers.