Studio Yotsuba
Back to Node List

NineSlice Render

nine_slice_render

Renders a nine-slice material at an arbitrary pixel size.

Reviewed
Guide available

Input Ports

NameTypeDescription
NineSlice
nine_slice
NineSlice
Required
Nine-slice material created by NineSlice Pack.
Width
width
Int
Optional output width override.
Height
height
Int
Optional output height override.

Output Ports

NameTypeDescription
Image
image
Image
Rendered window image.
Content Rect
content_rect
Map
Suggested x/y/width/height area for text or icons.
Summary
summary
Text
Short result summary.
Warnings
warnings
Text
Warnings produced while rendering.

Parameters

NameTypeDefaultRangeDescription / Options
Width
width
Int
961–4096

Output width in pixels.

Height
height
Int
481–4096

Output height in pixels.

Edge Mode
edge_mode
Enum
Document—

Edge scaling override.

  • documentDocument
    Use the edge mode saved in the NineSlice material.
  • repeatRepeat
    Tile edge pixels repeatedly.
  • stretchStretch
    Stretch edge pixels to the requested length.
Center Mode
center_mode
Enum
Document—

Center scaling override.

  • documentDocument
    Use the center mode saved in the NineSlice material.
  • repeatRepeat
    Tile the center repeatedly.
  • stretchStretch
    Stretch the center to fill the area.
  • transparentTransparent
    Leave the center transparent.
Min Size Policy
min_size_policy
Enum
Clamp—

How to handle sizes smaller than the fixed border area.

  • clampClamp
    If the requested size is too small, expand it to the minimum drawable size.
  • warnWarn
    Expand too-small sizes and write a warning.
  • errorError
    Fail when the requested size is smaller than the border area.

Overview

Renders a NineSlice asset as a window image of the requested dimensions. Only the edges and center resize, leaving the corners intact, so the same asset can produce both a name box and a full-screen window.

Usage tips

  • Complete the workflow with nine_slice_pack: pack defines the asset, render sets its dimensions. Attach multiple Render nodes to batch-produce UI at different sizes.
  • Repeat is the standard choice for pixel-art borders. Stretch can elongate patterns and damage the pixel-art look.
  • Promote width / height to input pins 📌 to animate a window opening.

Related nodes

  • nine_slice_pack — the asset counterpart

  • blend — overlays text and icons

  • text_rasterize — generates text to place in the window

  • Primary uses: message windows, UI panels, button backgrounds, name boxes, and status frames

This node accepts a NineSlice asset and renders it at the specified width and height. It preserves the corners and resizes only the edges and center, keeping pixel-art borders clean in a large window.

Edge scale methods

Value Display name Description
Document Asset setting Uses the setting stored by NineSlice Pack.
Repeat Repeat Tiles the edge part. Best for pixel-art borders.
Stretch Stretch Stretches the edge part to the output dimensions.

Center scale methods

Value Display name Description
Document Asset setting Uses the setting stored by NineSlice Pack.
Repeat Repeat Tiles the center part.
Stretch Stretch Stretches the center part to the output dimensions.
Transparent Transparent Leaves the center undrawn and transparent.

Minimum-size handling

A nine-slice generally cannot be smaller than the sum of its left and right borders or its top and bottom borders. Choose how to handle smaller requests.

Value Display name Description
Clamp Expand automatically Expands an undersized request to the smallest renderable size.
Warn Warn and expand Expands to the minimum size and writes a note to warnings.
Error Raise an error Does not render and raises an error when the requested size is too small.

Basic usage

  1. Connect nine_slice from NineSlice Pack to this node's nine_slice input.
  2. Set width and height.
  3. Connect image to Preview or another node and inspect the window image.
  4. If needed, change edge_mode or center_mode to compare repeating and stretching.

Meaning of content_rect

content_rect is a guide for placing text or icons inside the window.

Key Meaning
x X coordinate of the content area's top-left corner
y Y coordinate of the content area's top-left corner
width Width of the content area
height Height of the content area

For example, if content_rect is x=8, y=8, width=80, height=32, placing text roughly within the 80x32 area beginning at (8, 8) helps keep it clear of the frame.

Notes

  • This node only renders. Create the asset and specify part order in NineSlice Pack.
  • To preserve pixel-art lines, start with edge_mode=Repeat.
  • Stretch also works for assets where patterns are unobtrusive, such as gradients or flat colors.
  • If padding consumes the output, content_rect has zero width or height and warnings contains content_rect_empty.
  • summary and warnings use stable locale-independent diagnostics. size_clamped reports an expanded undersized request.
Back to Node List