🖼️ Magic Image Fetcher (Anki Add-on)
Automatically fetch high-quality images for your Anki notes using Pexels, Unsplash, or Google Images (via SerpAPI). This add-on fills empty Picture fields in a selected deck, using AnkiConnect to communicate with Anki.
magic_image_fetcher/ ├── init.py ├── magic_image_fetcher.py ├── config.json ├── requirements.txt ├── README.md ├── LICENSE └── manifest.json
✨ Features Automatically finds and inserts an image into the Picture field if it’s empty. Supports multiple sources: Pexels, Unsplash, Google Images (via SerpAPI). Lets you select which deck and note fields to use as search input. Images are referenced and clickable — clicking them opens the photographer’s page or image source. Rotating log at debug.log (1MB, keep 5 backups). 🔧 Requirements Anki 2.1+ AnkiConnect (required; the add-on talks to Anki via HTTP on localhost:8765) Python 3 on your system Python package: requests (install with pip) 🛠️ Installation Step 1: Install Python (if not already installed)
Windows:
Download Python from python.org Run the installer and check “Add Python to PATH” (important!) Verify installation: open Command Prompt and type python —version
macOS:
Python 3 is usually pre-installed. Verify by opening Terminal and typing python3 —version
Linux:
Python 3 is usually pre-installed. Verify by opening Terminal and typing python3 —version Step 2: Install AnkiConnect In Anki, go to Tools → Add-ons → Get Add-ons… Enter code: 2055492159 Click OK and restart Anki Step 3: Install Magic Image Fetcher Download this add-on: From AnkiWeb (recommended): Use code 649414227 Or manually: Download and extract into your Anki add-ons folder Restart Anki Step 4: Install Python Dependencies
Open your command line (Command Prompt on Windows, Terminal on macOS/Linux) and run:
Windows:
python -m pip install requests
macOS/Linux:
python3 -m pip install requests
Step 5: Get API Keys (Free!)
What’s an API key? Think of it as a password that lets this add-on access free image databases. You need to create a free account on at least one of these services:
Option 1: Pexels (Recommended for beginners)
Go to pexels.com/api Click “Sign Up” and create a free account After logging in, you’ll see your API key — copy it!
Option 2: Unsplash
Go to unsplash.com/developers Create a free account and register a new application Copy the “Access Key”
Option 3: SerpAPI (Google Images)
Go to serpapi.com Sign up for a free account Copy your API key from the dashboard Step 6: Configure Your API Key In your Anki add-ons folder, find the magic_image_fetcher folder Rename config.example.json to config.json Open config.json with any text editor (Notepad, TextEdit, etc.) Paste your API key(s) like this: { “PEXELS_API_KEY”: “paste_your_pexels_key_here”, “UNSPLASH_ACCESS_KEY”: “paste_your_unsplash_key_here”, “SERPAPI_KEY”: “paste_your_serpapi_key_here” }
Save the file Restart Anki
Done! You should now see “🖼️ Fetch Images” in the Tools menu.
📸 How to Use Click Tools → 🖼️ Fetch Images Select your target deck. Select search fields visually using dropdown menus: The add-on automatically detects available fields from your selected deck’s note type Choose up to 3 fields in order of preference via interactive dropdowns Selected fields will be searched in the order you chose (first field is highest priority) Choose your preferred image source. The script will find empty Picture fields and fill them with an image based on your field content. If no image is found for the given field, the next option is taken. If no image is found either way, the next note without picture is processed. 📁 Configuration
Edit config.json like so:
{ “PEXELS_API_KEY”: “your_pexels_key_here”, “UNSPLASH_ACCESS_KEY”: “your_unsplash_key_here”, “SERPAPI_KEY”: “your_serpapi_key_here” }
Missing keys will hide those sources from the picker.
🌐 API Key Sources Pexels: https://www.pexels.com/api/ Unsplash: https://unsplash.com/developers SerpAPI: https://serpapi.com/
All of these services offer free API plans suitable for lightweight use.
💡 Tips Only one image will be fetched per note to minimize API usage. Images are fetched in medium or high quality depending on source support. Make sure the field name Picture exists in your note type, or adjust the script if needed. Logs are written to debug.log with rotation (1MB, keep 5 backups). Be mindful of API rate limits.
Liên kết hỗ trợ
Reviews (4)
👍 2026-01-02
Unfortunately, I don’t understand how to install it at all. I only heard python severl times and never used it. I tried to downloand python 3, but I find it hard to understand how to download a Python package. I asked ChatGPT to teach me, but the reaction of my laptop is different from what it said it should be. And I don’t understand where to change that code. Very confused. Also, I don’t know what an API is. This add-on is not friendly to me at all. I finally delate python and want to delete t
👍 2025-09-02
Very good ad on to help my french anki deck become even better. takes some time to setup but it works very well It would be great if there was an option to automatically localise the images on ankiweb - right now i need another plugin so the pictures are visible on my android phone.
👍 2025-05-15
Amazing tool to quickly get images for your cards!
👍 2025-05-08
I know the person who made this AddOn and he showed me it working on his computer in a really magical way, now I want it for my decks too. Thank you so much!