Studio Yotsuba
Back to Node List

Content Bounds

content_bounds

Measure the occupied pixel bounds and transparent margins without changing the image

Reviewed
Guide available

Input Ports

NameTypeDescription
Image
input
Image
Required
Image whose occupied bounds will be measured

Output Ports

NameTypeDescription
X
x
Int
Left edge in source pixels
Y
y
Int
Top edge in source pixels
Width
width
Int
Occupied width, always at least 1
Height
height
Int
Occupied height, always at least 1
Original Width
original_width
Int
Source image width
Original Height
original_height
Int
Source image height
Left Margin
margin_left
Int
Transparent pixels before the occupied bounds
Top Margin
margin_top
Int
Transparent pixels above the occupied bounds
Right Margin
margin_right
Int
Transparent pixels after the occupied bounds
Bottom Margin
margin_bottom
Int
Transparent pixels below the occupied bounds
Is Empty
is_empty
Bool
True when no pixel passes the selected content rule

Parameters

NameTypeDefaultRangeDescription / Options
Alpha Threshold
alpha_threshold
Float
0.010–1 / step 0.01

Minimum alpha counted as content. Use 0 for every non-transparent pixel, about 0.01 for faint antialiasing, or 0.5 to ignore soft halos

Include Hidden RGB
include_transparent_rgb
Bool
false—

Count fully transparent pixels with non-zero RGB. Enable only when checking hidden matte colors or interpolation borders

Overview

Reports the X, Y, width, and height of visible content without modifying the image. Use it to inspect padding before atlas packing, detect empty animation frames, or crop while retaining the original origin.

Usage tips

  • For automatic cropping, connect image → content_bounds → crop. Connect the source image directly to crop.input, and wire x, y, width, and height to the matching promoted crop parameters.
  • Start with an alpha threshold of 0–0.01 for ordinary pixel art. Raise it to about 0.25–0.5 only when soft shadows or glow make the bounds too large.
  • Include Transparent RGB is an inspection option for assets that intentionally preserve color in fully transparent pixels. Leave it off for normal appearance-based cropping.
  • Even when is_empty=true, width and height are 1. This safe value prevents a zero-size error downstream; use is_empty as the branch condition when empty frames must be removed.

Common mistakes

  • Shadows or glow are included: raise the alpha threshold slightly. If the outline is clipped, the value is too high.
  • An invisible image reports the full canvas: check whether Include Transparent RGB is on.
  • Animation placement jitters: cropping every frame independently changes its origin. Use one union bound for all frames or store X/Y in the export manifest.

Related nodes

  • crop — crop to the measured rectangle
  • canvas_resize — place the cropped result back on a fixed canvas
  • region_info — measure area and center for each existing Region instead of the whole image
Back to Node List