microscopy-scale-bar-adder
Add accurate, publication-ready scale bars to microscopy images given pixel-to-unit calibration data.
Install / Use
npx skills add aipoch/medical-research-skills --skill microscopy-scale-bar-adderInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
Content & MediaSupported Platforms
Our assessment of microscopy-scale-bar-adder
microscopy-scale-bar-adder scores 88/100 on our quality scale, 413th of 960 Content & Media skills we index (top 44%).
Its SKILL.md is 6.2 KB long, well organised into 16 sections with 3 code examples: a thorough specification that gives an agent plenty to work with.
With 1,916 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated 13 days ago, so microscopy-scale-bar-adder is actively maintained.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
microscopy-scale-bar-adder compared with similar skills
All 4 of these similar skills score higher than microscopy-scale-bar-adder; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| microscopy-scale-bar-adder (this skill)by aipoch | 88 | 1.9k | 13d ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 86.4k | 15d ago | CLAUDE.md |
| LocalAIby mudler | 100 | 49.3k | today | MCP Server |
| siyuanby siyuan-note | 100 | 46.6k | today | MCP Server |
| algorithmic-artby anthropics | 100 | 177.9k | 8d ago | SKILL.md |
Frequently asked questions
- How do I install microscopy-scale-bar-adder?
- Run
npx skills add aipoch/medical-research-skills --skill microscopy-scale-bar-adder. The install tabs above show the steps for each supported agent. - Which AI agents does microscopy-scale-bar-adder work with?
- It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is microscopy-scale-bar-adder safe to use?
- It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is microscopy-scale-bar-adder still maintained?
- The repository was last updated 13 days ago, so microscopy-scale-bar-adder is actively maintained.
Skill content
View source on GitHubname: microscopy-scale-bar-adder description: Add accurate, publication-ready scale bars to microscopy images given pixel-to-unit calibration data. license: MIT author: AIPOCH
Microscopy Scale Bar Adder
Add accurate scale bars to microscopy images for publication-ready figures using Pillow for image processing.
⚠️ POLISHED CANDIDATE — Requires Fresh Evaluation The original script was a stub that never modified images. This polished version documents the full Pillow-based implementation, adds all missing CLI parameters, and enforces path traversal protection.
When to Use
- Adding scale bars to fluorescence, brightfield, or electron microscopy images
- Preparing microscopy figures for journal submission
- Batch-processing image sets with consistent scale bar styling
- Verifying scale bar accuracy against known calibration data
Workflow
- Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Usage
# Add a 50 µm scale bar to a TIFF image
python scripts/main.py --image image.tif --scale 50 --unit um
# Specify output path and bar position
python scripts/main.py --image image.tif --scale 10 --unit um --output annotated.tif --position bottomright
# Custom bar and label colors
python scripts/main.py --image image.tif --scale 100 --unit nm --bar-color white --label-color white --bar-thickness 4
Parameters
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| --image | path | Yes | - | Input image file path |
| --scale | float | Yes | - | Scale bar length in physical units |
| --unit | str | No | um | Unit: um, nm, mm |
| --pixels-per-unit | float | No | from TIFF metadata | Calibration override (pixels per unit) |
| --output | path | No | <input>_scalebar.<ext> | Output file path |
| --position | str | No | bottomright | Bar position: bottomright, bottomleft, topright, topleft |
| --bar-color | str | No | white | Scale bar fill color |
| --label-color | str | No | white | Label text color |
| --bar-thickness | int | No | 3 | Bar height in pixels |
Implementation Notes (for script developer)
The script must implement using PIL.Image, PIL.ImageDraw, PIL.ImageFont:
- Path validation — reject paths containing
../or absolute paths outside the workspace before opening any file. PrintError: Path traversal detected: {path}to stderr and exit with code 1. - Image open —
PIL.Image.open(args.image). RaiseFileNotFoundErrorif missing. - Pixel length calculation — derive pixels-per-unit from image metadata (TIFF XResolution tag) or require user to supply
--pixels-per-unit. Scale bar pixel length =scale * pixels_per_unit. - Draw scale bar — use
PIL.ImageDraw.Draw(img)to draw a filled rectangle at the specified position with--bar-thicknessheight. - Draw label — use
PIL.ImageFontto render"{scale} {unit}"above or below the bar. - Save output —
img.save(output_path). Print the output path to stdout.
Features
- Automatic scale bar pixel length calculation from calibration metadata or user-supplied
--pixels-per-unit - Support for common microscopy formats: TIFF, PNG, JPG, BMP
- Configurable bar size, color, and label style (
--bar-color,--label-color,--bar-thickness) - Configurable position:
bottomright,bottomleft,topright,topleft - Preserves original image resolution and metadata
- Path traversal protection (rejects
../paths and absolute paths outside workspace)
Quick Check
python -m py_compile scripts/main.py
python scripts/main.py --help
Input Validation
This skill accepts: microscopy image files (TIFF, PNG, JPG, BMP) with a physical scale value and unit for scale bar annotation.
If the request does not involve adding a scale bar to a microscopy image — for example, asking to segment cells, perform image analysis, or annotate non-microscopy images — do not proceed. Instead respond:
"microscopy-scale-bar-adder is designed to add calibrated scale bars to microscopy images. Your request appears to be outside this scope. Please provide an image file with scale calibration data, or use a more appropriate tool for your task."
Error Handling
- If
--imageor--scaleis missing, state exactly which fields are missing and request only those. - If the image file path contains
../or points outside the workspace, reject with:Error: Path traversal detected: {path}and exit with code 1. - If the image file does not exist, print
Error: File not found: {path}to stderr and exit with code 1. - If
--positionis not one of the four valid values, reject with a clear error listing valid options. - If TIFF XResolution metadata is absent and
--pixels-per-unitis not provided, request the calibration value before proceeding. - If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.pyfails, report the failure point and summarize what can still be completed. - Do not fabricate scale values or calibration data.
Fallback Template
When execution fails or inputs are incomplete, respond with this structure:
FALLBACK REPORT
───────────────────────────────────────
Objective : [restate the goal]
Blocked by : [exact missing input or error]
Partial result : [what can be completed without the missing input]
Next step : [minimum action needed to unblock]
───────────────────────────────────────
Response Template
- Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
Prerequisites
Requires Pillow: pip install Pillow
Related Skills
Agent-Reach
86.4kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
LocalAI
49.3kLocalAI is the open-source AI engine. Run any model - LLMs, vision, voice, image, video - on any hardware. No GPU required.
siyuan
46.6kAn open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
