Agent Skills
FigureVisualization

Multi-panel Figure Assembler

AIPOCH-AI

Automatically stitch 6 different subgraphs (A-F) into a high-resolution composite image, automatically align edges, unify font sizes, and add labels.

33
1
FILES
multi-panel-figure-assembler/
skill.md
scripts
example.py
main.py
__init__.py

SKILL.md

Multi-panel Figure Assembler

A Python-based tool for assembling multi-panel scientific figures. Automatically arranges 6 sub-figures (A-F) into a composite image with consistent styling, labels, and high-resolution output.

Features

  • Automatic Layout: Supports 2×3 or 3×2 grid arrangements
  • Edge Alignment: Intelligently crops/pads images to match dimensions
  • Unified Typography: Consistent font sizing across all panels
  • Auto Labeling: Adds panel labels (A-F) with customizable position
  • High Resolution: Output at 300+ DPI for publication quality

Installation

Requires Python 3.8+ and the following packages:

pip install Pillow numpy

Optional for advanced features:

pip install opencv-python-headless

Usage

python scripts/main.py --input A.png B.png C.png D.png E.png F.png --output figure.png [OPTIONS]

Command Line Arguments

ArgumentRequiredDefaultDescription
--input / -iYes-6 input image paths (A-F)
--output / -oYes-Output file path
--layout / -lNo2x3Layout: 2x3 or 3x2
--dpi / -dNo300Output DPI (dots per inch)
--label-fontNoArialFont family for labels
--label-sizeNo24Font size for panel labels
--label-positionNotopleftLabel position: topleft, topright, bottomleft, bottomright
--padding / -pNo10Padding between panels (pixels)
--border / -bNo2Border width around each panel (pixels)
--bg-colorNowhiteBackground color (white/black/hex)
--label-colorNoblackLabel text color (black/white/hex)

Parameters

ParameterTypeDefaultDescription
--inputstrRequired
--outputstrRequiredOutput file path
--layoutstr"2x3"
--dpiint300
--label-fontstr"Arial"
--label-sizeint24
--label-positionstr"topleft"
--paddingint10
--borderint2
--bg-colorstr"white"
--label-colorstr"black"

Examples

Basic usage:

python scripts/main.py -i A.png B.png C.png D.png E.png F.png -o figure.png

3×2 layout with custom DPI:

python scripts/main.py -i A.png B.png C.png D.png E.png F.png -o figure.png --layout 3x2 --dpi 600

Custom styling:

python scripts/main.py -i A.png B.png C.png D.png E.png F.png -o figure.png \
  --label-size 32 --label-position topright --padding 20 --border 4

Programmatic usage:

from scripts.main import FigureAssembler

assembler = FigureAssembler(
    layout="2x3",
    dpi=300,
    label_size=24,
    padding=10
)

assembler.assemble(
    inputs=["A.png", "B.png", "C.png", "D.png", "E.png", "F.png"],
    output="figure.png",
    labels=["A", "B", "C", "D", "E", "F"]
)

Output

The script generates a high-resolution composite figure with:

  • All panels resized to uniform dimensions
  • Panel labels (A-F) in specified positions
  • Consistent padding and borders
  • DPI metadata embedded in output file

Supported Formats

Input: PNG, JPG, JPEG, BMP, TIFF, GIF Output: PNG (recommended), JPG, TIFF

Notes

  • Input images are automatically resized to match the largest dimension while maintaining aspect ratio
  • For best results, use input images with similar aspect ratios
  • Label fonts require the font to be available on your system
  • PNG output preserves transparency if any input images have alpha channels

Risk Assessment

Risk IndicatorAssessmentLevel
Code ExecutionPython/R scripts executed locallyMedium
Network AccessNo external API callsLow
File System AccessRead input files, write output filesMedium
Instruction TamperingStandard prompt guidelinesLow
Data ExposureOutput files saved to workspaceLow

Security Checklist

  • No hardcoded credentials or API keys
  • No unauthorized file system access (../)
  • Output does not expose sensitive information
  • Prompt injection protections in place
  • Input file paths validated (no ../ traversal)
  • Output directory restricted to workspace
  • Script execution in sandboxed environment
  • Error messages sanitized (no stack traces exposed)
  • Dependencies audited

Prerequisites

# Python dependencies
pip install -r requirements.txt

Evaluation Criteria

Success Metrics

  • Successfully executes main functionality
  • Output meets quality standards
  • Handles edge cases gracefully
  • Performance is acceptable

Test Cases

  1. Basic Functionality: Standard input → Expected output
  2. Edge Case: Invalid input → Graceful error handling
  3. Performance: Large dataset → Acceptable processing time

Lifecycle Status

  • Current Stage: Draft
  • Next Review Date: 2026-03-06
  • Known Issues: None
  • Planned Improvements:
    • Performance optimization
    • Additional feature support