sci-figure

Original🇺🇸 English
Translated
11 scripts

Extracts figures and sub-figures from academic PDF papers. Supports Fig/Figure, Scheme, Chart, Supplementary Figure, Extended Data Figure (Nature), and Chinese equivalents (图/方案/示意图/附图/补充图). Sub-figure label recognition supports (a)/(A)/a)/(i)/(1)/a. formats. High-quality PNG output at configurable DPI. Use when user asks to "extract figure", "截取文献图片", "提取子图", "get figure from paper", "Scheme", "方案图", "补充图", "Supplementary Figure", or "Extended Data".

8installs
Added on

NPX Install

npx skill4agent add shzhao27208/aut_sci_write sci-figure

Sci-Figure — Scientific Figure Extractor

Precisely extract figures and sub-figures from academic PDF papers.

Installation

Install the package from the skill directory before first use:
bash
cd ${SKILL_DIR}
pip install -e .
This registers the
sh-sci-fig
CLI command. Requires Tesseract OCR:
  • Windows:
    winget install UB-Mannheim.TesseractOCR
  • Linux:
    apt install tesseract-ocr
  • macOS:
    brew install tesseract

Preferences (EXTEND.md)

Use Bash to check EXTEND.md existence (priority order):
bash
# Check project-level first
test -f .baoyu-skills/sci-figure/EXTEND.md && echo "project"

# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.baoyu-skills/sci-figure/EXTEND.md" && echo "user"
EXTEND.md Supports: Default DPI | Default output format | Tesseract path

Usage

bash
sh-sci-fig <input.pdf> [options]

Options

OptionShortDescriptionDefault
<input>
PDF file pathRequired
--figure
-f
Figure number (1, 2, 3...)Required (except --list/--all)
--subfigure
-s
Sub-figure label (a, b, c...)None (returns whole figure)
--output
-o
Output directoryCurrent directory
--dpi
-d
Output resolution600
--list
-l
List all available figure numbersfalse
--all
Extract all figuresfalse
--format
Output format (png/jpg)png
--quiet
-q
Suppress info messagesfalse

Examples

bash
# Extract Figure 2, sub-figure c
sh-sci-fig paper.pdf -f 2 -s c

# Extract entire Figure 3
sh-sci-fig paper.pdf -f 3

# List all available figures in a PDF
sh-sci-fig paper.pdf --list

# Extract all figures
sh-sci-fig paper.pdf --all

# Custom output directory and DPI
sh-sci-fig paper.pdf -f 2 -s c -o ./output/ -d 300
Output:
Extracted: figure_2c.png (1920x1080, 600 DPI)

Error Handling

ScenarioBehavior
Figure number not foundError + list all available figure numbers
OCR recognition failedReturn entire figure region
Sub-figure split failedReturn entire figure region
No sub-figure labels foundReturn entire figure region

Tech Stack

LibraryRole
pdfplumberText + coordinate extraction (locate "Figure X" labels)
PyMuPDF (fitz)PDF → high-quality image rendering (600 DPI)
opencv-pythonBoundary detection, contour analysis
PillowFinal cropping, format conversion
pytesseractOCR for sub-figure label recognition

Detected Figure Fields

FieldTypeDescription
number
intFigure number
page
intPage index (0-based)
bbox
tupleCrop region in pixels
bbox_pdf
tupleCrop region in PDF points
caption
strCaption text (truncated to 200 chars)
caption_full
strFull caption text (no truncation)
caption_bbox_pdf
tupleCaption bounding box in PDF points
sublabels
list[str]Sub-figure labels, e.g.
["a","b","c"]
sublabel_details
list[dict]Labels with detected format, e.g.
{"label":"a","format":"(a)"}
figure_type
strOne of:
figure
,
scheme
,
chart
,
supplementary
,
extended_data
is_supplementary
boolTrue for
supplementary
and
extended_data
types
image
ndarrayCropped figure image (numpy array)

Extension Support

Custom configurations via EXTEND.md. See Preferences section for paths and supported options.

© License & Copyright

Aut_Sci_Write — Autonomous Scientific Writer
  • Author: Shuo Zhao
  • License: MIT License
  • Copyright: © 2026 Shuo Zhao. All rights reserved.
  • Original Work: This is an original work created by the author. No reproduction, redistribution, or commercial use without explicit permission. Permission is hereby granted, free of charge, to any person obtaining a copy of this software... (See the LICENSE file in the root directory for the full MIT terms.)

This skill is part of the Aut_Sci_Write suite. For full license terms, see the LICENSE file in the project root.