Skip to content

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(image): harden bitmap treatments and provenance loading

hugohe389a0f254c61e
diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.md
index 9f8b1b0b..9fab0d03 100644
--- a/skills/ppt-master/references/executor-base.md
+++ b/skills/ppt-master/references/executor-base.md
@@ -13,7 +13,7 @@ Always-loaded Executor authority for flat SVG page authoring and behavior shared
| Any semantic cell grid, including a table-family reference | [`executor-table.md`](./executor-table.md) |
| A page will use a preset pattern fill or an independent object is explicitly selected as native-ready | [`native-data-interface.md`](./native-data-interface.md) before emitting the pattern or replacement metadata |
| Any image/formula | [`executor-image.md`](./executor-image.md) + [`image-layout-spec.md`](./image-layout-spec.md) + [`image-layout-patterns.md`](./image-layout-patterns.md) + [`svg-image-embedding.md`](./svg-image-embedding.md) |
-| Any `Status: Sourced` web image | [`executor-web-image.md`](./executor-web-image.md), after `executor-image.md` |
+| Any placed image is `Status: Sourced` or its filename has an `image_sources.json` record | [`executor-web-image.md`](./executor-web-image.md), after `executor-image.md` |
| Effective Speaker Notes outcome is enabled after all SVG pages pass | [`executor-notes.md`](./executor-notes.md) |
Evaluate branches from each object's actual information model, not only from a Chart/Table reference. A catalog family selects construction guidance but never native readiness; `Native-ready` is an independent object-level decision. Page-local qualitative geometry also never implies package-level `pptx_structure.mode: structured`.
diff --git a/skills/ppt-master/scripts/image_treat.py b/skills/ppt-master/scripts/image_treat.py
index 0518bb76..e0ba92f6 100644
--- a/skills/ppt-master/scripts/image_treat.py
+++ b/skills/ppt-master/scripts/image_treat.py
@@ -29,10 +29,18 @@ import os
import re
import sys
import tempfile
+from io import BytesIO
from pathlib import Path
from typing import Optional
-from PIL import Image, ImageEnhance, ImageFilter, ImageOps, UnidentifiedImageError
+from PIL import (
+ Image,
+ ImageCms,
+ ImageEnhance,
+ ImageFilter,
+ ImageOps,
+ UnidentifiedImageError,
+)
_SCRIPTS_DIR = Path(__file__).resolve().parent
@@ -141,7 +149,7 @@ def build_parser() -> argparse.ArgumentParser:
nargs=2,
type=_hex_color,
metavar=("SHADOW", "HIGHLIGHT"),
- help="Map luminance between two #RRGGBB colors.",
+ help="Map sRGB luminance between two sRGB #RRGGBB colors.",
)
parser.add_argument(
"--blur",
@@ -245,6 +253,47 @@ def _treatment_plan(args: argparse.Namespace) -> list[dict]:
return plan
+def _validate_blur_radius(radius: Optional[float], width: int, height: int) -> None:
+ if radius is None or radius <= 0:
+ return
+ effective_maximum = max(width, height)
+ if radius > effective_maximum:
+ raise ValueError(
+ f"blur radius {radius:g} exceeds the effective maximum "
+ f"{effective_maximum} for a {width}x{height} image; choose --blur "
+ f"at or below {effective_maximum}"
+ )
+
+
+def _convert_duotone_source_to_srgb(image: Image.Image) -> tuple[Image.Image, bytes]:
+ output_profile = ImageCms.ImageCmsProfile(ImageCms.createProfile("sRGB"))
+ output_icc = output_profile.tobytes()
+ source_icc = image.info.get("icc_profile")
+ if not source_icc:
+ return image.convert("RGB"), output_icc
+ if not isinstance(source_icc, bytes):
+ raise ValueError(
+ "source ICC profile has an unsupported representation; convert the "
+ "source to sRGB or remove the invalid profile, then retry"
+ )
+ try:
+ input_profile = ImageCms.ImageCmsProfile(BytesIO(source_icc))
+ converted = ImageCms.profileToProfile(
+ image,
+ input_profile,
+ output_profile,
+ outputMode="RGB",
+ )
+ except (ImageCms.PyCMSError, OSError, TypeError, ValueError) as exc:
+ raise ValueError(
+ "source ICC profile is invalid or incompatible with the image mode; "
+ "convert the source to sRGB or remove the invalid profile, then retry"
+ ) from exc
+ if converted is None:
+ raise RuntimeError("ICC conversion did not produce an image")
+ return converted, output_icc
+
+
def _has_alpha(image: Image.Image) -> bool:
return "A" in image.getbands() or "transparency" in image.info
@@ -264,12 +313,16 @@ def _apply_treatments(
try:
oriented.load()
width, height = oriented.size
- keep_icc = oriented.mode in {"RGB", "RGBA"}
- icc_profile = oriented.info.get("icc_profile") if keep_icc else None
+ _validate_blur_radius(args.blur, width, height)
has_alpha = _has_alpha(oriented)
rgba = oriented.convert("RGBA") if has_alpha else None
alpha = rgba.getchannel("A") if rgba is not None else None
- rgb = rgba.convert("RGB") if rgba is not None else oriented.convert("RGB")
+ if args.duotone is not None:
+ rgb, icc_profile = _convert_duotone_source_to_srgb(oriented)
+ else:
+ keep_icc = oriented.mode in {"RGB", "RGBA"}
+ icc_profile = oriented.info.get("icc_profile") if keep_icc else None
+ rgb = rgba.convert("RGB") if rgba is not None else oriented.convert("RGB")
if args.brightness is not None and args.brightness != 1:
rgb = ImageEnhance.Brightness(rgb).enhance(args.brightness)
diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.md
index cc7f1684..1c27774f 100644
--- a/skills/ppt-master/workflows/generate-pptx.md
+++ b/skills/ppt-master/workflows/generate-pptx.md
@@ -577,7 +577,7 @@ Keep the core's shared visual-quality defaults and `svg-effects.md` §6.1 Visual
| Actual row × column fact grid | `executor-table.md` |
| Used preset pattern fill, or independent Chart/Table with §IX `<object-key>=yes` | `native-data-interface.md` before that object |
| `spec_lock.md images` / §VIII has an image/formula row, or the template has bundled images | `executor-image.md` + `image-layout-spec.md` + `image-layout-patterns.md` + `svg-image-embedding.md` |
-| At least one placed image has `Status: Sourced` | `executor-web-image.md` after the image branch |
+| At least one placed image is `Status: Sourced` or its filename has an `image_sources.json` record | `executor-web-image.md` after the image branch |
| §I records recorded/self-running/video delivery, or §X records a final/literal narration script | `video-design.md` before the first SVG; retain it through notes/motion handling |
| All SVG pages and SVG quality gates are complete, and the effective Speaker Notes outcome in `design_spec.md §I` is enabled | `executor-notes.md` before generating speaker notes |
diff --git a/skills/ppt-master/workflows/profiles/quick-generate.md b/skills/ppt-master/workflows/profiles/quick-generate.md
index 2ed8cb2b..cdd435a6 100644
--- a/skills/ppt-master/workflows/profiles/quick-generate.md
+++ b/skills/ppt-master/workflows/profiles/quick-generate.md
@@ -413,8 +413,9 @@ page and reuse throughout the valid execution context:
[`image-layout-spec.md`](../../references/image-layout-spec.md),
[`image-layout-patterns.md`](../../references/image-layout-patterns.md), and
[`svg-image-embedding.md`](../../references/svg-image-embedding.md); add
-[`executor-web-image.md`](../../references/executor-web-image.md) for a sourced
-web image. Reread only after a known file change or context invalidation.
+[`executor-web-image.md`](../../references/executor-web-image.md) for a placed
+`Status: Sourced` image or filename recorded in `image_sources.json`.
+Reread only after a known file change or context invalidation.
`executor-structure.md` is loaded once before all SVG authoring so Quick cannot
omit shape-composition reasoning. Reuse it throughout the valid execution