AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(slice_images): retry once with the measured tolerance when every strict-alpha finding is key noise
hugohe3d475c0a75001
diff --git a/skills/ppt-master/references/image-generator.md b/skills/ppt-master/references/image-generator.mdindex e77801cc..62fc0649 100644--- a/skills/ppt-master/references/image-generator.md+++ b/skills/ppt-master/references/image-generator.md@@ -157,8 +157,8 @@ python3 scripts/slice_images.py <project>/images/illus_sheet.png --grid 2x3 \--names team,product,customer,growth,risk,vision --trim --alpha \--bg "${SHEET_KEY_HEX}" --strict-alpha# Generated sheets arrive through JPEG, so the ground is never exactly the pure-# key: the first run usually fails with a measured border line — rerun with the-# --bg / --tolerance it names (the measured ground, which skips despill).+# key: when every finding is measured key noise the tool retries once with the+# tolerance it measured; content touching a cell edge still fails and stays yours.````--names` count equals `rows*cols`; `--strict-alpha` writes nothing on an incomplete cut. Three quality constraints:diff --git a/skills/ppt-master/scripts/slice_images.py b/skills/ppt-master/scripts/slice_images.pyindex 95c67cef..52cb20dc 100644--- a/skills/ppt-master/scripts/slice_images.py+++ b/skills/ppt-master/scripts/slice_images.py@@ -760,6 +760,7 @@ def slice_sheet(strict_alpha: bool = False,bg: Optional[tuple[int, int, int]] = None,tolerance: int = 18,+ _auto_retry: bool = True,) -> list[Path]:"""Slice `sheet_path` into rows*cols element PNGs under `output_dir`.@@ -865,6 +866,31 @@ def slice_sheet(idx += 1if findings:+ # When every finding is measured key noise or drift (never content on+ # an edge), the tool already knows the tolerance that clears it: apply+ # it once instead of asking for the same command again.+ suggested = [+ int(match.group(1))+ for finding in findings+ for match in [re.search(r"rerun with --tolerance (\d+)", finding)]+ if match is not None+ ]+ if (+ strict_alpha+ and _auto_retry+ and len(suggested) == len(findings)+ ):+ retry_tolerance = max(suggested)+ _log(+ f"[WARN] strict alpha: all {len(findings)} finding(s) are key noise; "+ f"auto-retrying once with --tolerance {retry_tolerance} (measured)"+ )+ return slice_sheet(+ sheet_path, rows, cols, output_dir,+ names=names, prefix=prefix, inset=inset, trim=trim, alpha=alpha,+ strict_alpha=strict_alpha, bg=bg, tolerance=retry_tolerance,+ _auto_retry=False,+ )sheet_border = _sample_sheet_border(sheet) if strict_alpha else None_log_keying_findings(findings,diff --git a/skills/ppt-master/scripts/tests/test_slice_images.py b/skills/ppt-master/scripts/tests/test_slice_images.pyindex 4d0fc855..1a74179a 100644--- a/skills/ppt-master/scripts/tests/test_slice_images.py+++ b/skills/ppt-master/scripts/tests/test_slice_images.py@@ -132,7 +132,7 @@ class SliceImagesDiagnosticsTests(unittest.TestCase):self.assertIn("--bg #57B265 --tolerance 12", result.stderr)self.assertFalse((output_dir / "element.png").exists())- def test_strict_alpha_names_edge_wide_near_key_noise_as_key_noise(self) -> None:+ def test_strict_alpha_retries_once_when_every_finding_is_key_noise(self) -> None:with tempfile.TemporaryDirectory() as tmp:root = Path(tmp)sheet_path = root / "sheet.png"@@ -170,11 +170,13 @@ class SliceImagesDiagnosticsTests(unittest.TestCase):check=False,)- self.assertEqual(result.returncode, 1)- self.assertIn("this is key noise", result.stderr)+ # Every finding is measured key noise, so the tool retries once+ # with the tolerance it measured instead of asking for a rerun.+ self.assertEqual(result.returncode, 0, result.stderr)+ self.assertIn("key noise", result.stderr)+ self.assertIn("auto-retrying once with --tolerance", result.stderr)self.assertNotIn("content reaches the", result.stderr)- self.assertIn("Suggested rerun:", result.stderr)- self.assertFalse((output_dir / "element.png").exists())+ self.assertTrue((output_dir / "element.png").exists())def test_inset_accepts_horizontal_and_vertical_fractions(self) -> None:from slice_images import parse_inset