Image

From caidish/KlayoutClaw · View interactive version

Image is an AI agent skill from the GitHub repository caidish/KlayoutClaw. Load a reference image (microscope photo, optical image, SEM) into KLayout as a background overlay for design alignment. Use this skill whenever the user wants to load an image, add a background image, overlay a microscope photo, import a reference picture, align to a photo, or trace over an image.

How to use this skill

Skill file

KLayout Image Overlay

Load reference images (JPG, PNG, BMP) into KLayout as background overlays for aligning device geometry to real microscope photos.

Prerequisites

Scripts

add_image.py — Load an image as background overlay

python scripts/add_image.py <filepath> [--pixel-size 0.1] [--scale-bar <um> <pixels>] [--x 0] [--y 0] [--center]

Example — set pixel size directly:

python scripts/add_image.py ~/photos/graphene.jpg --pixel-size 0.1

Example — derive pixel size from a 20 um scale bar that spans 153 pixels:

python scripts/add_image.py ~/photos/graphene.jpg --scale-bar 20 153 --center
# Output: Scale bar: 20.0 um / 153.0 px = 0.1307 um/px

Example — load and center at a specific position:

python scripts/add_image.py ~/photos/flake.png --pixel-size 0.05 --x 100 --y 50 --center

list_images.py — List all background images in the view

python scripts/list_images.py

Prints a table of all loaded images with their ID, filename, position, and visibility.

remove_image.py — Remove a background image

python scripts/remove_image.py <image_id | all>

Workflow

  1. Load a microscope image as reference background
  2. Use geometry scripts to draw device features (contacts, gates, mesa) on top
  3. Adjust pixel-size to match the image's physical scale (check the scale bar)
  4. Use list_images.py to see loaded images, remove_image.py to clean up

Estimating pixel-size

If the image has a scale bar of length S microns spanning P pixels:

pixel-size = S / P

For example, a 20 um scale bar that spans 200 pixels gives pixel-size = 0.1.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.