Skip to content
extract-images logo

Image Extraction Skill

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.

SKILL.md

Full skill instructions

Image Extraction Skill

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

EndpointPurpose
POST /​api/​extract-imagesExtract images from pages
GET /​api/​galleryList 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

Smart Extraction (Recommended)

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:

  1. Finds pages with <image-desc> tags in OCR (from previous OCR pass)
  2. Uses AI to rank descriptions and pick the most interesting
  3. Only extracts those specific pages
  4. ~30 seconds for 20 images instead of scanning all pages

Full Extraction (All Pages)

For comprehensive extraction of every page (slow, use sparingly):

node scripts/​evaluate-extraction.mjs BOOK_ID --clear

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)

ScoreDescriptionExamples
0.9-1.0ExceptionalStriking emblems, allegorical scenes with figures
0.8-0.9HighImages featuring people, well-composed scenes
0.6-0.8GoodIllustrations without people, interesting diagrams
0.4-0.6ModerateMusical scores, simple diagrams
0.2-0.4LowPage ornaments, generic borders
0.0-0.2MinimalMarbled papers, blank frames

Key Rule: Images with people/​figures always score 0.8+

Image Types

TypeDescription
emblemSymbolic/​allegorical with motto
woodcutBold relief print lines
engravingFine detailed lines, crosshatching
portraitDepiction of a person
frontispieceDecorative title page
musical_scoreSheet music, notation
diagramTechnical/​scientific illustration
symbolAlchemical, astrological symbols
decorativeOrnaments, borders, initials
mapGeographic representation

Viewing Results

Gallery Page

https://sourcelibrary.org/​gallery?bookId=BOOK_ID

Book Guide Page (high-quality images only)

https://sourcelibrary.org/​book/​BOOK_ID/​guide

Individual Image Detail

https://sourcelibrary.org/​gallery/​image/​PAGE_ID:INDEX

Cost Estimation

Using Gemini 2.5 Flash:

MetricCost
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_photo or photo_original URLs
  • Re-run with --clear to retry

Wrong Classifications

If images are misclassified:

  • Edit via gallery UI at /​gallery/​image/​PAGE_ID:INDEX
  • Use PATCH endpoint to update type/​metadata

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

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...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

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...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

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.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View