onekit dev / 9-Slice Preview

9-Slice Preview

Drop a UI panel or button image, drag the four borders into place, preview how it stretches, and copy the values for Unity, Godot or CSS.

Drop a panel or button image herePNG with transparency works best. Nothing is uploaded.

How to set borders

Move each slider until its line sits just inside the decorated edge or rounded corner. Everything between the lines should be a flat color or a pattern that can stretch. Check the preview at a few widths and heights; if the corners distort, move the lines further in.

FAQ

What is 9-slice scaling?

The image is cut into nine parts by four lines. Corners stay the same size, edges stretch in one direction, and the center stretches both ways. That lets one small panel image fill buttons and windows of any size without warping the corners.

Where do I paste the values in Unity?

Open the sprite in the Sprite Editor and type the L, T, R and B values into the Border fields, then set the Image component to Sliced. In code, Sprite.border uses the order left, bottom, right, top, which is shown separately.

Where do I paste the values in Godot?

Use a NinePatchRect node, or a StyleBoxTexture, and set the four patch margins (left, top, right, bottom) to the values shown.

Why does my pixel art look blurry in the preview?

Turn up the zoom: the preview draws with hard edges at whole-number zoom levels. In your engine, use point or nearest filtering for pixel art textures.