inspect_spritesheet
Analyze a PNG spritesheet’s alpha channel to detect and return frame rectangles, so you can discover its layout before building animations.
Instructions
Inspect a PNG spritesheet and return frame rectangles.
Use this tool before building animations when you need to discover the
frame layout of a spritesheet. The alpha channel is analysed; pixels with
alpha strictly greater than alpha_threshold count as opaque.
Args:
image_path: Absolute path, relative path, or res://... URI to the
source PNG.
alpha_threshold: Opaque-pixel cutoff in the inclusive range 0..255.
Defaults to 10, so nearly transparent antialiasing is ignored.
mode: Detection strategy:
"grid" finds fully transparent horizontal/vertical separator lines,
"islands" finds 8-connected opaque islands and their tight bounding
boxes, and "auto" tries "grid" first and falls back to "islands"
when cell sizes are not uniform.
project_root: Optional Godot project root directory used to resolve
res:// URIs or relative paths.
Returns:
A JSON-compatible dictionary with image_width, image_height,
the detected mode, frame_count, and frames. Every frame is
{"id": int, "x": int, "y": int, "w": int, "h": int, "pivot_bottom_center": [float, float]}. Frames are ordered top to
bottom (row-clustered), then left to right.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | auto | |
| image_path | Yes | ||
| project_root | No | ||
| alpha_threshold | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||