xiaohongshu
xiaohongshu
extract-images
Extract 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.
Full skill instructions
Extract illustrations from historical book scans using Gemini vision AI. Creates a curated gallery with rich metadata for each image.
/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
For each illustration found:
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)| 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 |
# 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)'
Uses OCR <image-desc> tags to find pages with images, ranks them with AI, and only extracts the best 15-20:
# Extract top 20 images from a book
node scripts/smart-extract.mjs BOOK_ID --limit=20
# Extract top 15 images
node scripts/smart-extract.mjs BOOK_ID --limit=15
How it works:
<image-desc> tags in OCR (from previous OCR pass)For comprehensive extraction of every page (slow, use sparingly):
node scripts/evaluate-extraction.mjs BOOK_ID --clear
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
}'
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
"
| 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+
| 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 |
https://sourcelibrary.org/gallery?bookId=BOOK_ID
https://sourcelibrary.org/book/BOOK_ID/guide
https://sourcelibrary.org/gallery/image/PAGE_ID:INDEX
Using Gemini 2.5 Flash:
| Metric | Cost |
|---|---|
| Per page | ~$0.0004 |
| Per high-quality image | ~$0.0012 |
| 100-page book | ~$0.04 |
| 500-page book | ~$0.20 |
# 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
}'
The evaluation script has built-in 500ms delays. For higher throughput:
If extraction finds fewer images than expected:
cropped_photo or photo_original URLs--clear to retryIf images are misclassified:
/gallery/image/PAGE_ID:INDEXxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience