Fit
Fit an image into a target area, controlling aspect handling (fill, letterbox, stretch, or scale), alignment, and resampling quality.
What it does
Fit places an image into a target area and resolves any mismatch between the image's proportions and the target's: cover the area and crop the overhang, show the whole image and letterbox the gaps, lock one axis and let the other adjust, or distort the image to match exactly. Alignment then sets where the image anchors when it does not fill the area evenly.
Fit also reports the resolved width and height it fit into, so downstream nodes can read the target size back out.
When to use it
An image at one aspect ratio sitting inside a different one: a square post, a widescreen frame, a portrait card
Crop-to-fill without stretching (Fill), or the entire image with letterbox bars instead of cropping (Best)
One axis locked to the target while the other floats to preserve proportions (Fit Horizontal / Fit Vertical)
Control over which edge or corner the image hugs when cropped or letterboxed (Alignment)
| Parameter | Type | Default |
|---|---|---|
texture | OneOf([FieldOf(Raster), Collection]) | — |
fit_mode | String | "Fill" |
alignment | String | "Center" |
bounds_size | Vec2 | (1080, 1080) |
scale | Number | 100 |
filter | String | "Bilinear" |
wrap_mode | String | "Clamp" |
strength | Number | 1 |
Gotchas
Only Nearest and Bilinear filtering are active. Box, Bicubic and Lanczos are listed but currently resample the same as Bilinear.
Wrap Mode (Clamp / Repeat / Mirror) is not consumed yet either. Out-of-bounds sampling always behaves as Clamp regardless of the setting.
Fit applies its crop, letterbox and stretch maths to image inputs only. A collection of shapes passes through untouched while the target Width/Height outputs still report, which drives layout maths downstream without resampling anything.
Scale mode and the Scale percentage are not yet wired through; selecting Scale currently behaves like Fill. Use Fill, Best, Fit Horizontal, Fit Vertical or Stretch for a fit that can be relied on today.
Worked example
Add a Fit node and wire an image into Texture.
Set Bounds Size to your target dimensions, e.g. 1080 × 1080 for a square post.
Choose a Fit Mode: Fill to crop and cover, or Best to letterbox and show the whole image.
If the image crops or letterboxes unevenly, set Alignment to anchor it (Top, Center, Bottom Right, and so on).
Read Output into the rest of your graph, or tap Out Width / Out Height if a downstream node needs the resolved size.