Skip to content

armgit / klad

Public Imported from GitHub
0

A drawing app built for agent/human collaboration

Rust

klad check lists what stands out and counts the details

Indicode BVd4f1d3d4efcf
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b540549..34716b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
The first builds, and klad's licences.
+- `klad check` is quiet enough to read: it lists what stands out (a single pixel outside the shape or in a flat area, an L in a drawn line) and counts single pixels among other colours and corners in shading in one line as left out. A 64 px sprite that gave 77 findings gives 15. The editor's **Check pixels** marks the same ones.
- `klad export -o` takes a folder that exists for every kind of export and puts the export in it under its usual name; a sheet used to land next to the folder.
- A new icon, painted in klad: a K in two brush strokes.
- Two pixel art samples, `sprout` (a 32 px character with an idle and a walk) and `ground` (a tileset of 16 px tiles), in the start window and `klad samples`, and a guide, Drawing pixel art.
diff --git a/crates/app/src/editor/checks.rs b/crates/app/src/editor/checks.rs
index 692483d..bccdfae 100644
--- a/crates/app/src/editor/checks.rs
+++ b/crates/app/src/editor/checks.rs
@@ -32,13 +32,18 @@ pub(super) fn tally(found: &[klad_core::pixelcheck::Finding]) -> String {
let parts: Vec<String> = Kind::ALL
.iter()
.filter_map(|kind| {
- let count = found.iter().filter(|f| f.kind == *kind).count();
+ let count = found.iter().filter(|f| f.kind == *kind && !f.minor).count();
(count > 0).then(|| format!("{count} {}", kind.name()))
})
.collect();
+ let small = match found.iter().filter(|f| f.minor).count() {
+ 0 => String::new(),
+ 1 => " (1 small one, likely a detail, is not marked)".to_string(),
+ n => format!(" ({n} small ones, likely details, are not marked)"),
+ };
match parts.is_empty() {
- true => "nothing to look at on this layer".to_string(),
- false => format!("to look at, marked on the canvas: {}", parts.join(", ")),
+ true => format!("nothing to look at on this layer{small}"),
+ false => format!("to look at, marked on the canvas: {}{small}", parts.join(", ")),
}
}
@@ -454,7 +459,7 @@ impl Editor {
if let Some(check) = &self.checks.pixels {
let words = tally(&check.found);
self.say(
- match check.found.is_empty() {
+ match check.found.iter().all(|f| f.minor) {
true => Tone::Done,
false => Tone::Refused,
},
@@ -479,7 +484,7 @@ impl Editor {
let dark = Stroke::new(3.5, Color32::from_black_alpha(150));
if let Some(check) = &self.checks.pixels {
use klad_core::pixelcheck::Kind;
- check.found.iter().for_each(|f| {
+ check.found.iter().filter(|f| !f.minor).for_each(|f| {
let tint = match f.kind {
Kind::Stray => Color32::from_rgb(255, 196, 0),
Kind::Corner => Color32::from_rgb(255, 80, 120),
@@ -556,6 +561,33 @@ impl Editor {
mod tests {
use super::*;
+ #[test]
+ fn the_tally_counts_what_stands_out_and_names_the_small_ones() {
+ use klad_core::pixelcheck::{Finding, Kind};
+ let finding = |kind: Kind, minor: bool| Finding {
+ kind,
+ at: [1, 1],
+ to: [1, 1],
+ key: "ink".into(),
+ beside: Vec::new(),
+ note: String::new(),
+ minor,
+ };
+ assert_eq!(
+ tally(&[
+ finding(Kind::Stray, false),
+ finding(Kind::Stray, true),
+ finding(Kind::Corner, true)
+ ]),
+ "to look at, marked on the canvas: 1 stray pixel (2 small ones, likely details, are not marked)"
+ );
+ assert_eq!(
+ tally(&[finding(Kind::Stray, true)]),
+ "nothing to look at on this layer (1 small one, likely a detail, is not marked)"
+ );
+ assert_eq!(tally(&[]), "nothing to look at on this layer");
+ }
+
#[test]
fn the_job_arguments_are_the_cli_commands() {
assert_eq!(refill_args("a.klad", "l2", 4).join(" "), "refill a.klad l2 --frame 4");
diff --git a/crates/cli/src/check.rs b/crates/cli/src/check.rs
index d0647d5..bec4105 100644
--- a/crates/cli/src/check.rs
+++ b/crates/cli/src/check.rs
@@ -115,7 +115,10 @@ pub fn run(path: &Path, layer: Option<&str>, frame: u32, all: bool, as_json: boo
})
})
.collect::<Result<_>>()?;
- let total: usize = checked.iter().map(|c| c.found.len()).sum();
+ let total: usize = checked
+ .iter()
+ .map(|c| c.found.iter().filter(|f| !f.minor).count())
+ .sum();
if as_json {
let findings: Vec<serde_json::Value> = checked
.iter()
@@ -129,6 +132,7 @@ pub fn run(path: &Path, layer: Option<&str>, frame: u32, all: bool, as_json: boo
"to": f.to,
"color": name_of(doc, &f.key),
"note": words(doc, f),
+ "minor": f.minor,
})
})
})
@@ -144,13 +148,22 @@ pub fn run(path: &Path, layer: Option<&str>, frame: u32, all: bool, as_json: boo
}
checked.iter().for_each(|c| {
let head = format!("{} ({}), frame {}", c.layer.name, c.layer.id, c.frame);
- if c.found.is_empty() {
- println!("{head}: nothing to look at");
- return;
- }
- println!("{head}: {} to look at", c.found.len());
+ let small = c.found.iter().filter(|f| f.minor).count();
+ let main = c.found.len() - small;
+ println!(
+ "{head}: {}{}",
+ match main {
+ 0 => "nothing to look at".to_string(),
+ n => format!("{n} to look at"),
+ },
+ match small {
+ 0 => String::new(),
+ 1 => ", 1 small one left out".to_string(),
+ n => format!(", {n} small ones left out"),
+ }
+ );
Kind::ALL.iter().for_each(|kind| {
- let of_kind: Vec<&Finding> = c.found.iter().filter(|f| f.kind == *kind).collect();
+ let of_kind: Vec<&Finding> = c.found.iter().filter(|f| f.kind == *kind && !f.minor).collect();
of_kind.iter().take(SHOWN).for_each(|f| {
println!(
" {:<16} {:<16} {:<12} {}",
@@ -167,13 +180,28 @@ pub fn run(path: &Path, layer: Option<&str>, frame: u32, all: bool, as_json: boo
of_kind.len() - SHOWN
);
}
+ let left_out = c.found.iter().filter(|f| f.kind == *kind && f.minor).count();
+ if left_out > 0 {
+ println!(
+ " {:<16} {left_out} left out: {} (--json lists them)",
+ kind.name(),
+ match kind {
+ Kind::Stray => "single pixels among other colours, most likely details",
+ _ => "where two shades meet, not in a drawn line",
+ }
+ );
+ }
});
});
if total > 0 {
println!();
Kind::ALL
.iter()
- .filter(|kind| checked.iter().any(|c| c.found.iter().any(|f| f.kind == **kind)))
+ .filter(|kind| {
+ checked
+ .iter()
+ .any(|c| c.found.iter().any(|f| f.kind == **kind && !f.minor))
+ })
.for_each(|kind| println!("{}: {}", kind.name(), kind.advice()));
println!("These are places to look at, not errors: a single pixel can be an eye.");
}
diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs
index 2b80d08..8e5e93f 100644
--- a/crates/cli/src/main.rs
+++ b/crates/cli/src/main.rs
@@ -2000,7 +2000,7 @@ enum Command {
},
#[command(
about = "Look over pixel art: stray pixels, doubled corners, jagged lines, banding, colours off the palette",
- long_about = "Look over the pixel layers of a drawing for the usual slips of pixel art, and list each with its place:\n\n stray pixel a single pixel with no neighbour of its colour\n doubled corner a lone L in a one-pixel line, where the line reads thick (a corner whose arms are both two pixels or longer, as on a box, steps that go on all the way, and the edges of shapes are left alone)\n jagged line a short run between two longer ones in a one-pixel line, a step that breaks its rhythm\n banding a band one pixel wide, lighter than one side and darker than the other, that follows the edge next to it for four pixels or more\n off the palette pixels in a colour that is not a palette entry\n\n klad check sprite.klad every pixel layer, frame 0\n klad check sprite.klad body --frame 4 one layer (or a group's layers) at a frame\n klad check sprite.klad --all every drawing of every pixel layer\n klad check sprite.klad --json\n\nPlaces are canvas pixels, x,y from the top left, the way klad pixels counts them. These are places to look at, not errors: a single pixel can be an eye, and a band can be a rim light. klad render --focus or klad pixels shows the spot; klad pixel fixes it."
+ long_about = "Look over the pixel layers of a drawing for the usual slips of pixel art, and list each with its place:\n\n stray pixel a single pixel with no neighbour of its colour\n doubled corner a lone L in a one-pixel line, where the line reads thick (a corner whose arms are both two pixels or longer, as on a box, steps that go on all the way, and the edges of shapes are left alone)\n jagged line a short run between two longer ones in a one-pixel line, a step that breaks its rhythm\n banding a band one pixel wide, lighter than one side and darker than the other, that follows the edge next to it for four pixels or more\n off the palette pixels in a colour that is not a palette entry\n\n klad check sprite.klad every pixel layer, frame 0\n klad check sprite.klad body --frame 4 one layer (or a group's layers) at a frame\n klad check sprite.klad --all every drawing of every pixel layer\n klad check sprite.klad --json\n\nPlaces are canvas pixels, x,y from the top left, the way klad pixels counts them. These are places to look at, not errors: a single pixel can be an eye, and a band can be a rim light. klad render --focus or klad pixels shows the spot; klad pixel fixes it.\n\nWhat stands out is listed first: a single pixel outside the shape or in a field of one colour, an L in a line drawn in the darkest colour around it. Single pixels that sit among other colours (studs, glints, shading) and corners where two shades meet are most likely meant: they are counted in one line as left out, and --json lists them with \"minor\": true."
)]
Check {
bundle: PathBuf,
diff --git a/crates/cli/tests/binary.rs b/crates/cli/tests/binary.rs
index 51cbabc..285d9bf 100644
--- a/crates/cli/tests/binary.rs
+++ b/crates/cli/tests/binary.rs
@@ -1176,6 +1176,55 @@ fn a_pixel_layer_animates_frame_by_frame_moves_by_whole_pixels_and_refuses_in_be
std::fs::remove_dir_all(&dir).unwrap();
}
+#[test]
+fn klad_check_lists_what_stands_out_and_counts_the_details() {
+ let dir = std::env::temp_dir().join(format!("draw-binary-check-quiet-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&dir);
+ std::fs::create_dir_all(&dir).unwrap();
+ let bundle = dir.join("stud.klad");
+ let path = bundle.to_str().unwrap();
+ let draw = |args: &[&str]| {
+ let out = Command::new(env!("CARGO_BIN_EXE_klad")).args(args).output().unwrap();
+ assert!(
+ out.status.success(),
+ "{args:?}: {}",
+ String::from_utf8_lossy(&out.stderr)
+ );
+ String::from_utf8_lossy(&out.stdout).to_string()
+ };
+ draw(&["new", path, "--pixel", "8x6"]);
+ let grid = dir.join("stud.txt");
+ std::fs::write(
+ &grid,
+ "a = #20222e\nb = #6a7088\nc = #c8cedc\ns = #ffcc33\n\naabbb...\naasbb...\nccccc...\n........\n........\n.......s\n",
+ )
+ .unwrap();
+ draw(&["pixel", path, "l1", "--grid", grid.to_str().unwrap()]);
+ let listed = draw(&["check", path]);
+ assert!(
+ listed.contains("frame 0: 1 to look at, 1 small one left out"),
+ "{listed}"
+ );
+ assert!(
+ listed.contains("7,5") && listed.contains("alone, outside the shape"),
+ "{listed}"
+ );
+ assert!(
+ listed.contains("1 left out: single pixels among other colours") && !listed.contains("2,1 "),
+ "{listed}"
+ );
+ let found: serde_json::Value = serde_json::from_str(&draw(&["check", path, "--json"])).unwrap();
+ let small: Vec<&serde_json::Value> = found["findings"]
+ .as_array()
+ .unwrap()
+ .iter()
+ .filter(|f| f["minor"] == true)
+ .collect();
+ assert_eq!(small.len(), 1, "{found}");
+ assert_eq!(small[0]["at"], serde_json::json!([2, 1]));
+ std::fs::remove_dir_all(&dir).unwrap();
+}
+
#[test]
fn a_pixel_drawing_exports_sharp_at_whole_number_scales_as_png_gif_sheet_and_godot_scene() {
let dir = std::env::temp_dir().join(format!("draw-binary-pixel-export-{}", std::process::id()));
diff --git a/crates/core/src/pixelcheck.rs b/crates/core/src/pixelcheck.rs
index 1e972d3..70bda30 100644
--- a/crates/core/src/pixelcheck.rs
+++ b/crates/core/src/pixelcheck.rs
@@ -56,6 +56,8 @@ pub struct Finding {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub beside: Vec<String>,
pub note: String,
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ pub minor: bool,
}
type Cell = (i64, i64);
@@ -122,10 +124,38 @@ fn strays(field: &Field) -> Vec<Finding> {
key: key.to_string(),
beside: Vec::new(),
note: "alone: no neighbour of its colour".into(),
+ minor: false,
})
+ .map(|found| settled(field, found))
.collect()
}
+fn settled(field: &Field, found: Finding) -> Finding {
+ let cell = (found.at[0] as i64, found.at[1] as i64);
+ let around: Vec<Option<&str>> = AROUND
+ .iter()
+ .map(|(dx, dy)| field.at((cell.0 + dx, cell.1 + dy)))
+ .collect();
+ let empty = around.iter().filter(|key| key.is_none()).count();
+ let others: BTreeSet<&str> = around.iter().flatten().copied().collect();
+ match (empty >= 5, others.len() == 1 && empty <= 3) {
+ (true, _) => Finding {
+ note: "alone, outside the shape".into(),
+ ..found
+ },
+ (false, true) => Finding {
+ beside: others.iter().map(|key| key.to_string()).collect(),
+ note: "alone in a field of one colour".into(),
+ ..found
+ },
+ (false, false) => Finding {
+ note: "alone among other colours".into(),
+ minor: true,
+ ..found
+ },
+ }
+}
+
fn elbow(field: &Field, cell: Cell, key: &str) -> Option<[Cell; 2]> {
const BESIDE: [Cell; 4] = [(0, -1), (1, 0), (0, 1), (-1, 0)];
let arms: Vec<Cell> = BESIDE
@@ -142,7 +172,20 @@ fn elbow(field: &Field, cell: Cell, key: &str) -> Option<[Cell; 2]> {
(square && !field.is(inside, key) && !meant).then_some([(cell.0 + a.0, cell.1 + a.1), (cell.0 + b.0, cell.1 + b.1)])
}
-fn corners(field: &Field) -> Vec<Finding> {
+fn in_shading(field: &Field, cell: Cell, key: &str, colour: &dyn Fn(&str) -> Option<Rgba>) -> bool {
+ let light = |key: &str| colour(key).map(|c| to_oklab(c)[0]);
+ let Some(own) = light(key) else {
+ return false;
+ };
+ AROUND
+ .iter()
+ .filter_map(|(dx, dy)| field.at((cell.0 + dx, cell.1 + dy)))
+ .filter(|other| *other != key)
+ .filter_map(light)
+ .any(|other| other < own)
+}
+
+fn corners(field: &Field, colour: &dyn Fn(&str) -> Option<Rgba>) -> Vec<Finding> {
field
.cells()
.filter(|(cell, key)| {
@@ -167,6 +210,18 @@ fn corners(field: &Field) -> Vec<Finding> {
key: key.to_string(),
beside: Vec::new(),
note: "an L in a one-pixel line".into(),
+ minor: false,
+ })
+ .map(|found| {
+ let cell = (found.at[0] as i64, found.at[1] as i64);
+ match in_shading(field, cell, &found.key, colour) {
+ true => Finding {
+ note: "an L where two shades meet, not in a drawn line".into(),
+ minor: true,
+ ..found
+ },
+ false => found,
+ }
})
.collect()
}
@@ -298,6 +353,7 @@ fn jagged(field: &Field) -> Vec<Finding> {
"a run of {} between runs of {} and {}",
w[1].length, w[0].length, w[2].length
),
+ minor: false,
})
.collect::<Vec<_>>()
})
@@ -352,6 +408,7 @@ fn banding(field: &Field, colour: &dyn Fn(&str) -> Option<Rgba>) -> Vec<Finding>
key: first.1.to_string(),
beside: vec![first.0.to_string(), first.2.to_string()],
note: format!("one pixel wide for {length} pixels"),
+ minor: false,
});
}
start += length;
@@ -380,6 +437,7 @@ fn off_palette(field: &Field) -> Vec<Finding> {
1 => "1 pixel".to_string(),
n => format!("{n} pixels, the first here"),
},
+ minor: false,
})
.collect()
}
@@ -388,7 +446,7 @@ pub fn check(grid: &Grid, wrap: bool, colour: &dyn Fn(&str) -> Option<Rgba>) ->
let field = Field { grid, wrap };
let mut found: Vec<Finding> = strays(&field)
.into_iter()
- .chain(corners(&field))
+ .chain(corners(&field, colour))
.chain(jagged(&field))
.chain(banding(&field, colour))
.chain(off_palette(&field))
@@ -396,6 +454,7 @@ pub fn check(grid: &Grid, wrap: bool, colour: &dyn Fn(&str) -> Option<Rgba>) ->
found.sort_by(|a, b| {
a.kind
.cmp(&b.kind)
+ .then(a.minor.cmp(&b.minor))
.then(a.at[1].cmp(&b.at[1]))
.then(a.at[0].cmp(&b.at[0]))
});
@@ -456,6 +515,52 @@ mod tests {
);
}
+ #[test]
+ fn single_pixels_among_other_colours_and_corners_in_shading_are_small_findings() {
+ let all = |rows: &[&str]| check(&grid(rows), false, &shade);
+ let lone = |rows: &[&str]| -> Vec<(String, bool)> {
+ all(rows)
+ .into_iter()
+ .filter(|f| f.kind == Kind::Stray)
+ .map(|f| (f.note, f.minor))
+ .collect()
+ };
+ assert_eq!(
+ lone(&["i....", ".....", "....."]),
+ [("alone, outside the shape".to_string(), false)]
+ );
+ assert_eq!(
+ lone(&["bbbbb", "bbibb", "bbbbb"]),
+ [("alone in a field of one colour".to_string(), false)],
+ "a speck in a flat area stands out"
+ );
+ assert_eq!(
+ lone(&["aabbb", "aaibb", "ccccc"]),
+ [("alone among other colours".to_string(), true)],
+ "a stud where colours meet is most likely a detail"
+ );
+ let shaded = ["cbbbb", "bccbb", "bbcbb", "bbbcb"];
+ let corner: Vec<bool> = all(&shaded)
+ .into_iter()
+ .filter(|f| f.kind == Kind::Corner)
+ .map(|f| f.minor)
+ .collect();
+ assert_eq!(corner, [true], "a light L beside a darker shade is shading, not a line");
+ let drawn = ["ibbbb", "biibb", "bbibb", "bbbib"];
+ let corner: Vec<bool> = all(&drawn)
+ .into_iter()
+ .filter(|f| f.kind == Kind::Corner)
+ .map(|f| f.minor)
+ .collect();
+ assert_eq!(corner, [false], "the same L in the darkest colour is a drawn line");
+ let sorted: Vec<bool> = all(&["i....", ".....", "aabbb", "aaibb", "ccccc"])
+ .into_iter()
+ .filter(|f| f.kind == Kind::Stray)
+ .map(|f| f.minor)
+ .collect();
+ assert_eq!(sorted, [false, true], "what stands out comes first");
+ }
+
#[test]
fn an_l_in_a_thin_line_is_a_doubled_corner_but_a_box_corner_is_not() {
let slip = ["i....", ".ii..", "..i..", "...i."];
diff --git a/docs/cli.md b/docs/cli.md
index b1b88a5..90e54b8 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -3492,6 +3492,8 @@ Look over the pixel layers of a drawing for the usual slips of pixel art, and li
Places are canvas pixels, x,y from the top left, the way klad pixels counts them. These are places to look at, not errors: a single pixel can be an eye, and a band can be a rim light. klad render --focus or klad pixels shows the spot; klad pixel fixes it.
+What stands out is listed first: a single pixel outside the shape or in a field of one colour, an L in a line drawn in the darkest colour around it. Single pixels that sit among other colours (studs, glints, shading) and corners where two shades meet are most likely meant: they are counted in one line as left out, and --json lists them with "minor": true.
+
Usage: klad check [OPTIONS] <BUNDLE> [LAYER]
Arguments:
diff --git a/docs/skill/SKILL.md b/docs/skill/SKILL.md
index 85fb58d..ff3ec46 100644
--- a/docs/skill/SKILL.md
+++ b/docs/skill/SKILL.md
@@ -145,7 +145,7 @@ klad export sprite.klad --scale 8 -o [email protected] square pixels, to keep
- Animation is frame by frame: a pixel layer holds a drawing per frame like a paint layer (`klad add sprite.klad cel --in l1 frame=2`, then `klad pixel ... --frame 2`; `klad duplicate`, links, holds, clips and `--overlay onion` all work). To make the next frame, read the last one (`klad pixels sprite.klad l1 --frame 0 --plain`), change the text and write it to the new frame. Keying a pixel layer (`klad key sprite.klad l1 --frame 4 x=6`) moves it by whole pixels: positions in between are rounded, so a slow move steps a pixel at a time. `klad inbetween`, `klad pose`, `klad weights` and `klad attach` refuse pixel layers and say why: they move points and bend strokes, which would take pixels off the grid.
- Palette variants are other colours for the same sprite (teams, seasons, a hurt flash, day and night): `klad palette sprite.klad --new-variant blue` makes one and shows it, and every colour you change while it is shown (`--recolour team --to '#2a6fdb'`, `--add` with an existing name) is blue's own; the base palette keeps its colours, and a variant follows the base for every colour it has not changed. `--variant base` (or `--variant blue`) shows another one: the pixels stay the same marks, only their colours change, as one undo step. `klad palette sprite.klad` lists what is shown and each variant's own colours; `--rename-variant blue --to navy` and `--rm-variant navy` do what they say. Draw in the base palette and bind the parts that will change to their own palette colours (a `team` colour and its shades, not the same red that is also used for the mouth), or a variant changes more than you meant. Export without switching: `klad export sprite.klad --variant blue` renders that variant whatever is shown (file names get `-blue` after the drawing's name), and `--variants` exports the base and every variant in one go; both work with `--sheet`, `--frames`, `--gif` and `--godot`. Variants recolour pixel marks only: strokes on paint layers and vector shapes store their own colours.
- Exports stay sharp: a pixel drawing exports at whole-number scales only (`--scale 1` to 64, at most 16384 px a side), enlarged pixel for pixel, never smoothed; `--scale 2.5` is refused with the reason. That holds for `klad export` of a frame, `--sheet`, `--frames`, `--gif` and `--godot` (sheet cells and the Godot offset are scaled with it; the Godot scenes set `texture_filter` to nearest so the sprite stays sharp in the game). To show a sprite to someone, `klad export sprite.klad --gif --scale 8`; in a game, export at `--scale 1` and let the engine enlarge it.
-- Check your pixels before you call a sprite done: `klad check sprite.klad` (a layer or group, `--frame N`, `--all` for every drawing, `--json`) lists the usual slips with their places in canvas pixels: `stray pixel` (a single pixel with no neighbour of its colour), `doubled corner` (a lone L in a one-pixel line, where it reads thick; corners whose arms are both two pixels or longer, as on a box, regular steps and the edges of shapes are left alone), `jagged line` (a short run between two longer ones, a step that breaks the line's rhythm), `banding` (a one-pixel band between a darker and a lighter colour that follows the edge beside it for four pixels or more) and `off the palette` (pixels in a colour that is not a palette entry). They are places to look at, not errors: an eye is a stray pixel, a rim light is a band. Fix what is a slip (`klad pixel --erase --cells`, redraw the run, `klad recolour`), leave what is meant, and run it again; a clean drawing prints `nothing to look at`.
+- Check your pixels before you call a sprite done: `klad check sprite.klad` (a layer or group, `--frame N`, `--all` for every drawing, `--json`) lists the usual slips with their places in canvas pixels: `stray pixel` (a single pixel with no neighbour of its colour), `doubled corner` (a lone L in a one-pixel line, where it reads thick; corners whose arms are both two pixels or longer, as on a box, regular steps and the edges of shapes are left alone), `jagged line` (a short run between two longer ones, a step that breaks the line's rhythm), `banding` (a one-pixel band between a darker and a lighter colour that follows the edge beside it for four pixels or more) and `off the palette` (pixels in a colour that is not a palette entry). What stands out comes first (a single pixel outside the shape or in a field of one colour, an L in a line drawn in the darkest colour around it); single pixels among other colours and corners where two shades meet are summed in one line as left out (`--json` lists them with `"minor": true`). They are places to look at, not errors: an eye is a stray pixel, a rim light is a band. Fix what is a slip (`klad pixel --erase --cells`, redraw the run, `klad recolour`), leave what is meant, and run it again; a clean drawing prints `nothing to look at`.
- Tilesets. A drawing can be cut into tiles of one size: `klad new ground.klad --pixel 64x48 --tile 16` (or `klad canvas ground.klad --tile 16`, `16x24` for other shapes, `--tile off` to undo); each side of the canvas has to be a whole number of tiles, and `klad canvas ground.klad` says how many there are. Work one tile at a time: `klad pixels ground.klad l1 --tile 2,0 --plain` reads the tile in column 2 of row 0 with its pixels counted from its own corner, and `klad pixel ground.klad l1 --grid - --tile 2,0` draws a grid there (`--at` then moves it inside the tile); every other command still uses canvas pixels, and a tile's corner is column times width, row times height. Keep each tile inside its own cell, and check seams by reading two neighbours: a tile's last column has to meet the next tile's first. `klad export ground.klad --tileset ../game/art` writes a Godot TileSet (`ground-tiles.png` and `ground-tiles.tres`, one atlas source, a tile for every cell that is not empty; `--scale`, `--frame` and `--variant` as for other exports; the folder is the drawing's Godot folder once given). In Godot the TileMapLayer's texture filter has to be Nearest for pixel tiles. `--wrap` is a different thing: it makes the whole canvas one repeating tile.
- Pictures to pixels. `klad pixelize sprite.klad --image ref.png --to l1` puts a PNG or JPEG on a pixel layer: every pixel takes the nearest colour of the drawing's palette (so it lands in the colours the sprite has; `--colors N` makes N colours from the picture and adds them instead), `--size 48` shrinks it to 48 px on its longest side first (each pixel the average of the area it covers; a picture enlarged by a whole number comes back exact; pixels less than half solid stay empty), `--at x,y` places its top left, `--frame` picks the drawing. `klad import ref.png [--size N] [--colors N]` makes a new pixel drawing from a picture, with the picture's own colours as its palette (reduced to 32 when it has more than 256). `klad pixelize hero.klad --size 64 [--layer body] [--colors 12] [-o out.klad]` makes a new pixel drawing (`hero-pixel.klad`) of a painted or vector layer or of the whole picture, every frame with one set of colours, frames that come out the same held, clips kept; the drawing itself is not changed. All three give marks bound to palette colours, one per colour, so the result is edited like anything else here. Treat it as a start, not a finish: shrinking blurs edges into in-between colours and breaks one-pixel outlines, so look at it at real size, then redraw the outline, cut stray colours with `klad recolour --from a --to b`, and run `klad check` on it.
- Aseprite files: `klad import hero.aseprite` (or `.ase`; `-o` names the drawing) makes `hero.klad` next to the file: image layers as pixel layers with their name, visibility, opacity and blend mode, groups as groups, every cel as a drawing on its frame (linked cels stay links), the palette with its names, tags as clips. Frame times become whole frames at the slowest speed that fits (100 ms frames are 10 fps; a 300 ms frame holds for three). Indexed, grey and RGBA files all open, every pixel bound to its palette colour. It says what it leaves out: tilemap layers, tilesets, slices, tag directions other than forwards, blend modes klad lacks. `klad export hero.klad --aseprite` writes the pixel layers and groups back (RGBA; holds and links as linked cels, clips as tags, a pixel layer's keyed moves and opacity baked into its cels; `--variant` and `--variants` work); paint, vector and other layers are left out and named. Use it to hand work to someone who uses Aseprite, or to take over a sprite made there.
diff --git a/docs/skill/pixel/SKILL.md b/docs/skill/pixel/SKILL.md
index 6b4d800..68c5161 100644
--- a/docs/skill/pixel/SKILL.md
+++ b/docs/skill/pixel/SKILL.md
@@ -30,7 +30,7 @@ You draw enlarged and the player sees it small, so what you see while working is
A cluster is a group of touching pixels of one colour that reads as one shape. Pixel art is built from clusters, the way a painting is built from strokes.
- Make clusters simple and a little chunky: wedges, crescents, blocks with one cut corner. A shadow is a shape, not a row.
-- A single pixel with no neighbour of its colour is noise unless it is a detail the viewer should find: an eye, a glint, a button. Decide which. `klad check` lists them as stray pixels.
+- A single pixel with no neighbour of its colour is noise unless it is a detail the viewer should find: an eye, a glint, a button. Decide which. `klad check` lists the ones that stand out as stray pixels (alone outside the shape, or alone in a flat area) and counts the ones that sit among other colours without listing them.
- Avoid one-pixel strings of a colour running through a shape, and pixels scattered like salt. Both read as dirt.
- Every edge between two clusters is a line and wants the care of a line.