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
fix(slice): keep despill on a near-key measured ground; glow tails are not haze
hugohe3adbfdf48a371
diff --git a/skills/ppt-master/scripts/docs/image.md b/skills/ppt-master/scripts/docs/image.mdindex 72f6a0da..19dafdf5 100644--- a/skills/ppt-master/scripts/docs/image.md+++ b/skills/ppt-master/scripts/docs/image.md@@ -173,7 +173,8 @@ a gradient, lighting, or texture painted by the image model — is keyed bykey-channel dominance against a local ground estimate instead of one colour,with a notice to inspect the cut, as is a flat ground farther from every purekey than drift explains (the measured `--bg` rerun, or the sheet's own ground-without `--bg`) so shadows cast on it clear, while a flat ground that merely+without `--bg`) so shadows cast on it clear — a measured ground within drift+of a pure key keeps pure-key recovery — while a flat ground that merelydiffers from the stated key is still rejected with the measured colour to rerunwith), analready prepared RGBA asset or the active host image editor for a standalone cutout, anddiff --git a/skills/ppt-master/scripts/slice_images.py b/skills/ppt-master/scripts/slice_images.pyindex 06d1c0e6..bc3d7c0e 100644--- a/skills/ppt-master/scripts/slice_images.py+++ b/skills/ppt-master/scripts/slice_images.py@@ -611,6 +611,12 @@ def _content_masks(trim_mask = diff.point(lambda p: 255 if p > tolerance else 0)tolerance_gate = _soft_mask_from_diff(diff, tolerance)key_index = _pure_chroma_channel(bg)+ if key_index is None:+ # A measured ground within drift of a pure key is that key drifted;+ # it keeps pure-key recovery, gated by distance to the measured ground.+ drifted = _nearest_pure_key(bg)+ if drifted is not None:+ key_index = _pure_chroma_channel(drifted[0])if key_index is not None:chroma_alpha, keyed_rgb = _pure_key_recovery(rgb, key_index)alpha_mask = ImageChops.multiply(chroma_alpha, tolerance_gate)@@ -764,7 +770,9 @@ def _haze_finding(cell, border_ratio=0.10, key=bg,)dominant_distance = max(abs(dominant[index] - bg[index]) for index in range(3))- if max(dominant_distance, spread, distance) <= tolerance:+ # Haze comes from the field itself; a glow or shadow tail entering the+ # margin over an on-key field recovers as soft alpha and is not haze.+ if max(dominant_distance, spread) <= tolerance:return Nonehex_bg = "#{:02X}{:02X}{:02X}".format(*bg)measured_bg = "#{:02X}{:02X}{:02X}".format(*dominant)diff --git a/skills/ppt-master/scripts/tests/test_slice_images.py b/skills/ppt-master/scripts/tests/test_slice_images.pyindex e2ea4c69..bf775bcf 100644--- a/skills/ppt-master/scripts/tests/test_slice_images.py+++ b/skills/ppt-master/scripts/tests/test_slice_images.py@@ -347,6 +347,34 @@ class SliceImagesDiagnosticsTests(unittest.TestCase):self.assertEqual(tuple(cut[50, 50]), (150, 90, 60, 255))self.assertLess(int(alpha[-5:, -5:].max()), 200)+ def test_glow_tail_in_margin_over_on_key_ground_is_not_haze(self) -> None:+ import numpy as np++ with tempfile.TemporaryDirectory() as tmp:+ root = Path(tmp)+ sheet_path = root / "sheet.png"+ size = 200+ yy, xx = np.mgrid[0:size, 0:size]+ radius = np.hypot(xx - 100, yy - 100)+ # A pale disc whose soft glow fades into the key-only margin.+ coverage = np.where(radius <= 40, 1.0, np.clip(1 - (radius - 40) / 70, 0, 1) * 0.35)+ ground = np.array([2.0, 8.0, 254.0])+ sheet = ground * (1 - coverage[..., None]) + np.array([235.0, 225.0, 200.0]) * coverage[..., None]+ Image.fromarray(sheet.astype(np.uint8), "RGB").save(sheet_path)++ for bg in ((0, 0, 255), (2, 8, 254)):+ with self.subTest(bg=bg):+ out = root / f"out_{bg[0]}"+ slice_sheet(+ sheet_path, 1, 1, out, names=["moon"],+ alpha=True, strict_alpha=True, bg=bg, tolerance=18,+ )+ cut = np.asarray(Image.open(out / "moon.png").convert("RGBA"), dtype=np.int16)+ red, green, blue, alpha = (cut[..., index] for index in range(4))+ # A measured near-key ground still despills: the glow is not blue.+ bluish = (alpha >= 40) & (blue > np.maximum(red, green) + 30)+ self.assertEqual(int(bluish.sum()), 0)+def test_strict_alpha_names_painted_card_cells_instead_of_a_key_rerun(self) -> None:with tempfile.TemporaryDirectory() as tmp:root = Path(tmp)