Image Extraction Skill
SkillMediaExtract and catalog illustrations from historical books using AI vision. Generates rich metadata (subjects, figures, symbols, style, technique) and museum-style descriptions. Use when asked to extract images, run image detection, or process book illustrations.
Use Image Extraction Skill in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Image Extraction Skill and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Image Extraction Skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by embassy-of-the-free-mind/sourcelibrary-v2 in .claude/skills/extract-images/SKILL.md and read by Ahel’s review.
Extract illustrations from historical book scans using Gemini vision AI. Creates a curated gallery with rich metadata for each image.
Invocation
/extract-images # Show extraction status across library
/extract-images BOOK_ID # Extract images from specific book
/extract-images --all # Extract from all books missing images
/extract-images --priority # Extract from high-priority books first
What Gets Extracted
For each illustration found:
- Bounding box - Precise crop coordinates
- Type classification - emblem, woodcut, engraving, portrait, frontispiece, musical_score, diagram, symbol, decorative, map
- Gallery quality score - 0.0-1.0 rating for curation
- Museum description - 2-3 sentence scholarly label
- Structured metadata:
subjects- Topics (alchemy, transformation, mythology)figures- People/beings depicted (Mercury, serpent, old man)symbols- Symbolic elements (ouroboros, athanor, philosophical egg)style- Art historical style (Northern European Renaissance)technique- Production method (woodcut, engraving)
API Endpoints
| Endpoint | Purpose |
|---|---|
POST /api/extract-images | Extract images from pages |
GET /api/gallery | List extracted images |
GET /api/gallery/image/[id] | Get single image with metadata |
PATCH /api/gallery/image/[id] | Update metadata/quality |
Check Extraction Status
# Get books with extraction counts
curl -s "https://sourcelibrary.org/api/books" | jq '[.[] | {
id,
title: .title[0:40],
pages: .pages_count,
images: (.detected_images_count // 0)
}] | sort_by(-.pages)'
# Find books needing extraction (no detected_images)
curl -s "https://sourcelibrary.org/api/books" | jq '[.[] |
select((.detected_images_count // 0) == 0) |
{id, title: .title[0:40], pages: .pages_count}
] | sort_by(-.pages)'
Extract Images from a Book
Via Pipeline (Recommended)
Image extraction runs automatically as part of the pipeline (images phase). Books with OCR <image-desc> tags get processed by Lambda workers.
To manually trigger extraction for a specific book:
# Queue image extraction via API
curl -X POST "https://sourcelibrary.org/api/books/BOOK_ID/pipeline" \
-H "Authorization: Bearer $CRON_SECRET" \
-H "Content-Type: application/json" \
-d '{"action": "extract_images"}'
Via API (Individual Pages)
curl -s -X POST "https://sourcelibrary.org/api/extract-images" \
-H "Content-Type: application/json" \
-d '{
"bookId": "BOOK_ID",
"pageIds": ["PAGE_ID_1", "PAGE_ID_2"],
"overwrite": false
}'
Books with OCR Image Descriptions
Check which books have <image-desc> tags (best for smart extraction):
# Find books with image descriptions in OCR
node -e "
const { MongoClient } = require('mongodb');
require('dotenv').config({ path: '.env.local' });
// ... aggregation to find books with <image-desc> tags
"
Output Quality
Gallery Quality Scoring (0.0-1.0)
| Score | Description | Examples |
|---|---|---|
| 0.9-1.0 | Exceptional | Striking emblems, allegorical scenes with figures |
| 0.8-0.9 | High | Images featuring people, well-composed scenes |
| 0.6-0.8 | Good | Illustrations without people, interesting diagrams |
| 0.4-0.6 | Moderate | Musical scores, simple diagrams |
| 0.2-0.4 | Low | Page ornaments, generic borders |
| 0.0-0.2 | Minimal | Marbled papers, blank frames |
Key Rule: Images with people/figures always score 0.8+
Image Types
| Type | Description |
|---|---|
emblem | Symbolic/allegorical with motto |
woodcut | Bold relief print lines |
engraving | Fine detailed lines, crosshatching |
portrait | Depiction of a person |
frontispiece | Decorative title page |
musical_score | Sheet music, notation |
diagram | Technical/scientific illustration |
symbol | Alchemical, astrological symbols |
decorative | Ornaments, borders, initials |
map | Geographic representation |
Viewing Results
Gallery Page
https://sourcelibrary.org/gallery?bookId=BOOK_ID
Book Guide Page (high-quality images only)
https://sourcelibrary.org/book/BOOK_SLUG
Individual Image Detail
https://sourcelibrary.org/gallery/image/PAGE_ID:INDEX
Cost Estimation
Using Gemini 3 Flash:
| Metric | Cost |
|---|---|
| Per page | ~$0.0004 |
| Per high-quality image | ~$0.0012 |
| 100-page book | ~$0.04 |
| 500-page book | ~$0.20 |
Monitoring Extraction
# Check extraction results for a book
curl -s "https://sourcelibrary.org/api/gallery?bookId=BOOK_ID" | jq '{
total: .total,
high_quality: [.images[] | select(.galleryQuality >= 0.75)] | length,
types: [.images[].type] | group_by(.) | map({type: .[0], count: length})
}'
# Sample image metadata
curl -s "https://sourcelibrary.org/api/gallery/image/PAGE_ID:0" | jq '{
type,
galleryQuality,
museumDescription,
metadata
}'
Troubleshooting
Rate Limiting
The evaluation script has built-in 500ms delays. For higher throughput:
- Use multiple API keys (rotate on 429)
- Reduce delay for paid tiers
Missing Images
If extraction finds fewer images than expected:
- Check page image quality (blurry scans)
- Verify pages have
cropped_photoorphoto_originalURLs - Re-run with
--clearto retry
Wrong Classifications
If images are misclassified:
- Edit via gallery UI at
/gallery/image/PAGE_ID:INDEX - Use PATCH endpoint to update type/metadata
Signals
- GitHub stars
- 21
- Forks
- 4
- Last commit
- Oct 2026
Advanced
- Item type
- skill
- Key
extract-images- Source
- github.com/embassy-of-the-free-mind/sourcelibrary-v2
github.com/embassy-of-the-free-mind/sourcelibrary-v2