add_outline
Draw a pixel outline around artwork already on a layer, with optional light-weighted thickness for sticker-style keylines or rim lights.
Instructions
Add a pixel outline around the artwork on a layer, optionally weighted by light.
The outline is drawn around the art **already on the layer given, onto that same
layer**. It does not outline other layers, so it cannot draw a keyline onto a fresh
empty layer of its own; a layer with no drawn pixels on the frame is refused rather
than reported as an outline that drew nothing.
Args:
color: Outline colour.
thickness: Outline width in pixels (default 1). With `light_angle`, this is the
width on the edges that face away from the light.
connectivity: 4 (orthogonal only) or 8 (includes diagonals, default).
where: "outside" (grow into transparency, default) or "inside"
(recolour the shape's border pixels).
light_angle: Degrees, 0 from the right and 90 from above, as the shading tools
state it. Given, the outline's width varies by which way each edge faces:
`thickness` where the form turns away from the light, `lit_thickness` where
it faces into it, and **everything between the two across the band of edge in
between**.
lit_thickness: Width on the edges facing the light. 0 drops the outline there
entirely. Defaults to one pixel less than `thickness`. A value above
`thickness` is allowed and puts the weight on the lit side instead, which is
a rim light rather than a weighted outline.
A constant-width border is the single thing that most reliably makes a sprite read as
a die-cut sticker: nothing lit has an edge of uniform darkness, so the eye sees card
stamped out with a punch rather than a form in light. Hand-drawn work in this style
gathers the weight where the surface turns away and lets it vanish on the lit top
faces. `thickness=2, light_angle=135, lit_thickness=0` is that look.
The weight **tapers** rather than switching. The lit and shadow widths are the two ends
of a run of integers, and each edge pixel takes the one its facing selects, so a 2-to-0
keyline passes through 2, then 1, then 0 across a band of edge instead of flipping
between two values at the terminator. Facing is measured over a neighbourhood rather
than over the touching pixels, which is what makes the band continuous on a lumpy
silhouette: at a radius of one, a single-pixel bump swings the facing by ninety degrees
and the keyline comes apart into scraps. Measured by walking the boundary ring of a disc
with twelve bumps on it, the old per-pixel test crossed between outlined and bare 30
times, which is fifteen separate pieces of keyline; the taper crosses twice, which is
one arc. That fragmenting is why `lit_thickness=0` had to be reverted to 1 on this
project's own golem, where it measured better and looked damaged.
With the two widths one apart there are only two integers to choose from and the
changeover sits at the same facing the old comparison used, so
`thickness=2, lit_thickness=1` draws exactly what it drew before. The taper appears once
they differ by two or more, which is the case that was broken.
Reports `outline_weights` alongside the lit and shadow counts: how many of the
silhouette's own boundary pixels took each thickness, from 0 upward. That is the number
that says whether a pass tapered or switched, since a switch leaves the entries between
its two widths empty.
For an outline in colours taken from the artwork's own ramp rather than one flat
colour, see `outline_smart`, which varies hue instead of width.
A Background is refused, in either colour mode: every pixel on one is drawn, so an
outline has no empty pixel to go into or grow from. Outline the art on its own layer;
on an indexed sprite, `convert_background_to_layer` turns the transparent index back
into transparency first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filename": "<filename>",
"color": "<color>"
},
"name": "add_outline"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | Yes | ||
| frame | No | Default: 1. | |
| layer | No | ||
| where | No | Default: "outside". | outside |
| filename | Yes | ||
| thickness | No | Default: 1. | |
| light_angle | No | ||
| connectivity | No | Default: 8. | |
| lit_thickness | No |