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(pptx): close advanced image and motion audit gaps
hugohe390111a3ae007
diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex 294ad1e2..3e3add8f 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -51,6 +51,7 @@ python3 scripts/update_repo.py| PPTX animations | `pptx_animations.py`, `animation_config.py` | [docs/pptx-animations.md](./docs/pptx-animations.md) || Spec maintenance | `update_spec.py`, `chart_recall.py` | [docs/update_spec.md](./docs/update_spec.md); [docs/chart-recall.md](./docs/chart-recall.md) || Image tools | `image_gen.py`, `latex_render.py`, `analyze_images.py`, `gemini_watermark_remover.py` | [docs/image.md](./docs/image.md) |+| Maintenance smokes | Inline temporary-project commands | [advanced image and motion](./docs/advanced-image-motion-smoke.md); [mask and gradient](./docs/mask-gradient-smoke.md) || Repo maintenance | `update_repo.py` | README install/update section || Troubleshooting | validation, preview, export, dependency issues | [docs/troubleshooting.md](./docs/troubleshooting.md) |@@ -255,7 +256,7 @@ python3 scripts/finalize_svg.py <project_path>python3 scripts/svg_to_pptx.py <project_path>```-`finalize_svg.py` optimizes raster images by default using `2x` display pixels and max `2560px`. Native `svg_to_pptx.py` defaults to `--image-sizing cap`: oversized full sources normally reduce toward `2560px`, but cropped or stretched placements (including imported picture crops) retain enough source pixels to avoid undersupplying the visible frame. Use `svg_to_pptx.py --image-sizing display --image-scale 2` only for aggressive size reduction, or `--no-image-optimize` when the native PPTX must embed original image bytes.+`finalize_svg.py` optimizes ordinary raster images by default using `2x` display pixels and max `2560px`; validated nested crop transports retain source pixel dimensions because their inner `1×1` image is source-unit geometry rather than a rendered-pixel budget. Native `svg_to_pptx.py` defaults to `--image-sizing cap`: oversized full sources normally reduce toward `2560px`, but cropped or stretched placements (including imported picture crops) retain enough source pixels to avoid undersupplying the visible frame. Use `svg_to_pptx.py --image-sizing display --image-scale 2` only for aggressive size reduction, or `--no-image-optimize` when the native PPTX must embed original image bytes.`finalize_svg.py` remains mandatory because it creates the self-contained `svg_final/` visual preview. Those SVGs may be opened directly or inserted into PowerPoint as SVG pictures. The only supported generated-PPTX path is `svg_output/` through the project SVG-to-DrawingML converter; `-s final` is diagnostic-only, and PowerPoint's manual Convert-to-Shape operation is unsupported.diff --git a/skills/ppt-master/scripts/animation_config.py b/skills/ppt-master/scripts/animation_config.pyindex 8793f9f1..e350dc42 100644--- a/skills/ppt-master/scripts/animation_config.py+++ b/skills/ppt-master/scripts/animation_config.py@@ -66,7 +66,7 @@ def build_parser() -> argparse.ArgumentParser:validate = subparsers.add_parser('validate',- help='validate animations.json references against svg_output/*.svg',+ help='validate animations.json values and project-local references',)validate.add_argument('project_path', help='Project directory')validate.add_argument('-c', '--config', default=None, help='Config path; default: <project>/animations.json')diff --git a/skills/ppt-master/scripts/docs/advanced-image-motion-smoke.md b/skills/ppt-master/scripts/docs/advanced-image-motion-smoke.mdnew file mode 100644index 00000000..e2a7cac3--- /dev/null+++ b/skills/ppt-master/scripts/docs/advanced-image-motion-smoke.md@@ -0,0 +1,378 @@+# Advanced Image and Motion Maintenance Smoke++Run this manual smoke from the repository root after changing nested image+crop finalization, native picture export, deterministic Morph pairing, authored+PowerPoint presets, or their planning contracts. It builds one temporary+two-slide project under the gitignored `projects/_smoke_*` namespace and follows+the inline-smoke convention from+[`code-style.md`](../../../../docs/rules/code-style.md) §11; do not turn it into+a test file or public example deck.++The fixture deliberately closes the full planning and execution chain:++- `design_spec.md` carries `Motion suggestion`, `Native shape suggestion`, one+ current §VIII image row, and `Crop Policy`;+- `spec_lock.md` projects that row with optional layout pattern `#100`;+- both pages reuse one raster through ordinary, ellipse-preset, and custom-path+ independent nested crops;+- `animations.json` pairs the main crop across adjacent Morph pages;+- one helper-authored `rightArrow` verifies native preset discovery and export.++```bash+python3 - <<'PY'+import base64+import io+import json+import re+import subprocess+import sys+import tempfile+import zipfile+from pathlib import Path+from xml.etree import ElementTree as ET++from PIL import Image, ImageDraw++project = Path(+ tempfile.mkdtemp(+ prefix="_smoke_advanced_image_motion_",+ dir="projects",+ )+)+scripts = Path("skills/ppt-master/scripts")+images = project / "images"+svg_output = project / "svg_output"+images.mkdir()+svg_output.mkdir()+(project / "README.md").write_text(+ "# Advanced image and motion maintenance smoke\n",+ encoding="utf-8",+)+++def run_tool(script, *args):+ result = subprocess.run(+ [sys.executable, str(scripts / script), *map(str, args)],+ capture_output=True,+ text=True,+ )+ assert result.returncode == 0, result.stderr or result.stdout+ return result.stdout.strip()+++scene = Image.new("RGB", (1280, 720), "#E2E8F0")+draw = ImageDraw.Draw(scene)+draw.rectangle((0, 0, 420, 720), fill="#2563EB")+draw.rectangle((420, 0, 860, 720), fill="#F97316")+draw.rectangle((860, 0, 1280, 720), fill="#0F172A")+draw.ellipse((460, 150, 820, 510), fill="#F8FAFC")+scene.save(images / "scene.png")++preset = run_tool(+ "preset_shape_svg.py",+ "render",+ "rightArrow",+ "--id",+ "native-arrow",+ "--frame",+ "500",+ "570",+ "280",+ "80",+ "--fill",+ "#2563EB",+ "--stroke",+ "none",+)+preset = (+ '<g id="native-arrow-module" data-pptx-bounds="500 570 280 80">'+ + preset+ + "</g>"+)++(project / "design_spec.md").write_text(+ """<!-- ppt-master-schema: design-spec/v1 -->+# Advanced Image and Motion Smoke - Design Spec++## I. Project Information++| Item | Value |+| --- | --- |+| Project Name | advanced-image-motion-smoke |+| Canvas Format | PPT 16:9 |+| Page Count | 2 |++## II. Canvas Specification++- ViewBox: `0 0 1280 720`+- Format: `ppt169`++## III. Visual Theme++- Direction: restrained technical maintenance fixture+- Colors: blue, orange, slate, and white++## IV. Typography System++- Title: Arial, sans-serif at 36px+- Body: Arial, sans-serif at 20px++## V. Layout Principles++- Reuse one source image through independently editable crop objects.+- Keep every visible crop inside the slide canvas.++## VI. Icon Usage Specification++- No icons.++## VIII. Image Resource List++| Filename | Dimensions | Ratio | Purpose | Type | Layout pattern | Crop Policy | Acquire Via | Status | Reference | text_policy | page_role |+| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |+| scene.png | 1280x720 | 16:9 | Morph crop continuity | Photo | #100 same-source independent crops with a shaped detail | adaptive | user | Existing | Synthetic three-band scene for crop and Morph verification | none | local |++## IX. Content Outline++### Part 1: Crop continuity++#### Slide 01 - Overview++- **Audience move**: See separate source views as one editable image system.+- **Layout**: Ordinary crop, shaped crop, and one native directional preset.+- **Title**: Overview crop state+- **Core message**: One source can support independent native picture objects.+- **Content**: Show the wide crop and shaped detail together.+- **Images**: Use `scene.png` for both visible crop objects.+- **Native shape suggestion**: Use the PowerPoint `rightArrow` preset to indicate continuation.+- **Motion suggestion**: Continue the primary crop into Slide 02 as one deterministic Morph object.++#### Slide 02 - Detail++- **Audience move**: Recognize the same image after a controlled crop and position change.+- **Layout**: Enlarged primary crop plus a second shaped detail.+- **Title**: Detail crop state+- **Core message**: Morph identity is independent from the picture crop geometry.+- **Content**: Move and zoom the primary crop while preserving the shared source.+- **Images**: Reuse `scene.png`; do not generate or replace the source.+- **Motion suggestion**: Pair the primary crop with Slide 01 and use Morph by object.++## X. Speaker Notes Requirements++- Notes are disabled for this maintenance smoke.+""",+ encoding="utf-8",+)++(project / "spec_lock.md").write_text(+ """<!-- ppt-master-schema: spec-lock/v1 -->+# Execution Lock++## canvas+- viewBox: 0 0 1280 720+- format: ppt169+## communication+- audience: PPT Master maintainers+- objective: Verify advanced image and motion contracts end to end.+- core_message: One raster remains editable across native crops and Morph.+## mode+- mode: showcase+## visual_style+- visual_style: swiss-minimal+## colors+- bg: #FFFFFF+- primary: #2563EB+- accent: #F97316+- text: #0F172A+## typography+- font_family: Arial, sans-serif+- title_family: Arial, sans-serif+- body_family: Arial, sans-serif+- title: 36+- body: 20+## icons+- library: none+- inventory: none+## images+- scene: images/scene.png | source=user | pattern=#100 same-source independent crops with a shaped detail | crop=adaptive+## page_rhythm+- P01: dense+- P02: dense+## pptx_structure+- mode: flat+## forbidden+- Unsupported SVG constructs+""",+ encoding="utf-8",+)++slide_1 = f"""<svg xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 1280 720" data-pptx-page-role="content">+ <defs>+ <clipPath id="overview-shape" clipPathUnits="userSpaceOnUse">+ <ellipse cx="0.725" cy="0.5" rx="0.275" ry="0.5"/>+ </clipPath>+ </defs>+ <rect id="background" data-pptx-role="background"+ x="0" y="0" width="1280" height="720" fill="#FFFFFF"/>+ <g id="hero-overview" data-pptx-bounds="80 140 448 360">+ <svg id="overview-crop" x="80" y="140" width="448" height="360"+ viewBox="0 0 0.7 1" preserveAspectRatio="none" overflow="hidden">+ <image href="../images/scene.png" x="0" y="0" width="1" height="1"+ preserveAspectRatio="none"/>+ </svg>+ </g>+ <g id="shaped-overview" data-pptx-bounds="760 170 330 340">+ <svg id="overview-shaped-crop" data-pptx-crop="1"+ x="760" y="170" width="330" height="340"+ viewBox="0.45 0 0.55 1" preserveAspectRatio="none" overflow="hidden">+ <image href="../images/scene.png" x="0" y="0" width="1" height="1"+ preserveAspectRatio="none" clip-path="url(#overview-shape)"/>+ </svg>+ </g>+ {preset}+</svg>+"""++slide_2 = """<svg xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 1280 720" data-pptx-page-role="content">+ <defs>+ <clipPath id="detail-shape" clipPathUnits="userSpaceOnUse">+ <path d="M 0.5 1 L 0.75 0 L 1 1 Z"/>+ </clipPath>+ </defs>+ <rect id="background" data-pptx-role="background"+ x="0" y="0" width="1280" height="720" fill="#FFFFFF"/>+ <g id="hero-detail" data-pptx-bounds="0 0 1280 720">+ <svg id="detail-crop" x="0" y="0" width="1280" height="720"+ viewBox="0.15 0.1 0.36 0.36"+ preserveAspectRatio="none" overflow="hidden">+ <image href="../images/scene.png" x="0" y="0" width="1" height="1"+ preserveAspectRatio="none"/>+ </svg>+ </g>+ <g id="shaped-detail" data-pptx-bounds="820 160 320 360">+ <svg id="detail-shaped-crop" data-pptx-crop="1"+ x="820" y="160" width="320" height="360"+ viewBox="0.5 0 0.5 1" preserveAspectRatio="none" overflow="hidden">+ <image href="../images/scene.png" x="0" y="0" width="1" height="1"+ preserveAspectRatio="none" clip-path="url(#detail-shape)"/>+ </svg>+ </g>+</svg>+"""++(svg_output / "01_overview.svg").write_text(slide_1, encoding="utf-8")+(svg_output / "02_detail.svg").write_text(slide_2, encoding="utf-8")+(project / "animations.json").write_text(+ json.dumps(+ {+ "version": 1,+ "slides": {+ "02_detail": {+ "transition": {+ "effect": "morph",+ "effect_options": {"morph_by": "object"},+ "duration": 0.8,+ },+ "morph": {+ "from": "01_overview",+ "pairs": {+ "hero-image": {+ "from": "hero-overview",+ "to": "hero-detail",+ }+ },+ },+ }+ },+ },+ ensure_ascii=False,+ indent=2,+ )+ + "\n",+ encoding="utf-8",+)++run_tool("project_manager.py", "validate", project)+run_tool("svg_quality_checker.py", project, "--format", "ppt169")+run_tool("animation_config.py", "validate", project)+++def finalized_image_sizes():+ sizes = []+ for svg_path in sorted((project / "svg_final").glob("*.svg")):+ root = ET.parse(svg_path).getroot()+ for image in root.iter("{http://www.w3.org/2000/svg}image"):+ href = image.get("href") or image.get(+ "{http://www.w3.org/1999/xlink}href"+ )+ assert href and href.startswith("data:image/"), href+ payload = base64.b64decode(href.split(",", 1)[1], validate=True)+ with Image.open(io.BytesIO(payload)) as embedded:+ sizes.append(embedded.size)+ return sizes+++finalized_sizes = []+for finalize_args in ((), ("--no-compress",)):+ run_tool("finalize_svg.py", project, *finalize_args)+ embedded_sizes = finalized_image_sizes()+ assert len(embedded_sizes) == 4, embedded_sizes+ assert all(width > 100 and height > 100 for width, height in embedded_sizes)+ finalized_sizes.append(embedded_sizes)++pptx = project / "advanced-image-motion.pptx"+run_tool("svg_to_pptx.py", project, "--no-notes", "-o", pptx)+with zipfile.ZipFile(pptx) as archive:+ slide_names = sorted(+ name+ for name in archive.namelist()+ if re.fullmatch(r"ppt/slides/slide[12]\.xml", name)+ )+ slide_xml = [archive.read(name) for name in slide_names]+assert len(slide_xml) == 2, slide_names+assert all(b'!!hero-image' in xml for xml in slide_xml)+assert b'morph' in slide_xml[1]+assert sum(xml.count(b"<a:srcRect") for xml in slide_xml) >= 4+assert b'<a:prstGeom prst="ellipse">' in slide_xml[0]+assert b'<a:prstGeom prst="rightArrow">' in slide_xml[0]+assert b"<a:custGeom>" in slide_xml[1]++readback = project / "readback"+run_tool(+ "pptx_to_svg.py",+ pptx,+ "-o",+ readback,+ "--inheritance-mode",+ "flat",+ "--strict",+)+readback_svg = "\n".join(+ path.read_text(encoding="utf-8")+ for path in sorted((readback / "svg").glob("slide_*.svg"))+)+assert readback_svg.count('data-pptx-crop="1"') >= 2+assert readback_svg.count('data-pptx-shape-name="!!hero-image"') == 2++print(+ "Advanced image and motion smoke: passed "+ f"(embedded sizes={finalized_sizes}; project={project})"+)+PY+```++Every command must exit successfully. The finalized data URIs must retain+useful source pixels rather than collapsing to the nested child’s unit+coordinates; the package must contain four native picture crops, the authored+`rightArrow`, one Morph transition, and exactly one `!!hero-image` target on+each adjacent slide. The strict PPTX-to-SVG readback must restore both shaped+crop markers and both forced-Morph object names.++The printed project is intentionally retained for manual Microsoft PowerPoint+inspection. Morph must continue the primary picture without a visible+cross-fade, sharpness jump, or media re-decoding flash. That Office-only visual+check is evidence gathering; to stress differing media payloads, replace+`scene.png` with a `7680×4320` source and re-export. Do not trigger media+deduplication changes from package structure alone.diff --git a/skills/ppt-master/scripts/docs/pptx-animations.md b/skills/ppt-master/scripts/docs/pptx-animations.mdindex 91075c06..73b758e0 100644--- a/skills/ppt-master/scripts/docs/pptx-animations.md+++ b/skills/ppt-master/scripts/docs/pptx-animations.md@@ -190,6 +190,11 @@ the next `after-previous` row.## 6. Validation and Read-Back+Before export, `animation_config.py validate` uses the writer's effect-behavior+test for `bounce_end` and resolves declared sound paths against the project+root. Missing paths, non-files, and unsupported audio extensions fail this+project-level preflight; field-only validation remains filesystem-independent.+Generated export reads every slide back before packaging and compares eachrequested row with the serialized result:diff --git a/skills/ppt-master/scripts/docs/pptx-transitions.md b/skills/ppt-master/scripts/docs/pptx-transitions.mdindex a907d202..33c77fc4 100644--- a/skills/ppt-master/scripts/docs/pptx-transitions.md+++ b/skills/ppt-master/scripts/docs/pptx-transitions.md@@ -235,7 +235,7 @@ continue to preserve existing object names and transition XML.| Generated PPTX CLI | fade, 0.4s | click | auto-advance maps to both || Recorded narration | Preserve resolved enter | narration | none remains visually none || Template Fill | preserve source | preserve source | explicit effects replace; legacy advance_after maps to both |-| Native Enhance | Confirmed global/per-slide plan effect | Confirmed timing module | With audio off, enabled global transitions apply to all pages; with audio on, the scope flag controls non-narrated pages |+| Native Enhance | Confirmed global/per-slide plan effect | Confirmed timing module | With audio off, an enabled global transition or explicit global `none` applies to all pages; with audio on, the scope flag controls non-narrated pages |Template Fill changes source transitions only when its CLI or per-slide planselects a replacement, removal, or timed advance. Native Enhance uses itsdiff --git a/skills/ppt-master/scripts/native_enhance_pptx_core.py b/skills/ppt-master/scripts/native_enhance_pptx_core.pyindex 1df2c525..7155bad5 100644--- a/skills/ppt-master/scripts/native_enhance_pptx_core.py+++ b/skills/ppt-master/scripts/native_enhance_pptx_core.py@@ -1507,10 +1507,15 @@ def _resolve_transition_plan()if ("audio" not in modules- and ("transitions" in modules or cli_effect is not None)+ and (+ "transitions" in modules+ or cli_effect is not None+ or global_enter.policy == "none"+ )):# A confirmed global transition is independently actionable. The# narrated-only scope switch matters only while audio is enabled.+ # Explicit none remains an action even though the module is disabled.apply_without_audio = Trueraw_slides = transitions_cfg.get("slides", {})diff --git a/skills/ppt-master/scripts/pptx_animations.py b/skills/ppt-master/scripts/pptx_animations.pyindex f24746c8..110325fc 100644--- a/skills/ppt-master/scripts/pptx_animations.py+++ b/skills/ppt-master/scripts/pptx_animations.py@@ -171,6 +171,14 @@ ANIMATION_TIMING_OPTION_FIELDS = ()ANIMATION_RESTARTS = ('always', 'when-not-active', 'never')ANIMATION_AFTER_EFFECTS = ('none', 'dim', 'hide', 'hide-on-next-click')+_INTERPOLATED_BEHAVIOR_TAGS = frozenset({+ 'anim',+ 'animClr',+ 'animEffect',+ 'animMotion',+ 'animRot',+ 'animScale',+})_NON_CONCRETE_FONT_NAMES = frozenset({'-apple-system','blinkmacsystemfont',@@ -1454,6 +1462,32 @@ def _animation_row_for_options(return row+def _interpolated_behavior_nodes(row: ET.Element) -> tuple[ET.Element, ...]:+ """Return behavior nodes that can carry PowerPoint bounce metadata."""+ return tuple(+ node+ for node in row.iter()+ if _local_name(node.tag) in _INTERPOLATED_BEHAVIOR_TAGS+ )+++def animation_effect_supports_bounce_end(+ effect: object,+ effect_options: object = None,+) -> bool:+ """Return whether one concrete effect has an interpolated behavior."""+ animation, options = normalize_animation_effect_request(+ effect,+ effect_options,+ allow_none=False,+ allow_modes=False,+ )+ if animation is None:+ raise AssertionError('concrete animation normalization returned none')+ row = _animation_row_for_options(animation, options)+ return bool(_interpolated_behavior_nodes(row))++def _apply_timing_options(row: ET.Element, target: AnimationTarget) -> None:if target.repeat_count is not None:row.set('repeatCount', str(round(target.repeat_count * 1000)))@@ -1479,19 +1513,11 @@ def _apply_timing_options(row: ET.Element, target: AnimationTarget) -> None:else:row.attrib.pop('decel', None)if target.bounce_end is not None:- bounce_nodes = [- node- for node in row.iter()- if _local_name(node.tag) in {- 'anim',- 'animClr',- 'animEffect',- 'animMotion',- 'animRot',- 'animScale',- }- ]- if target.bounce_end and not bounce_nodes:+ bounce_nodes = _interpolated_behavior_nodes(row)+ if target.bounce_end and not animation_effect_supports_bounce_end(+ target.effect,+ target.effect_options,+ ):raise ValueError(f'animation effect {target.effect!r} has no behavior that ''supports bounce_end'diff --git a/skills/ppt-master/scripts/prompt_audit_manifest.json b/skills/ppt-master/scripts/prompt_audit_manifest.jsonindex de842b7d..f84e9b20 100644--- a/skills/ppt-master/scripts/prompt_audit_manifest.json+++ b/skills/ppt-master/scripts/prompt_audit_manifest.json@@ -12,7 +12,7 @@"skills/ppt-master/templates/schemas/*.json"],"exclude": [],- "max_tokens": 388200+ "max_tokens": 391000},"file_budgets": {"AGENTS.md": 2400,@@ -1136,6 +1136,10 @@"glob": "skills/ppt-master/scripts/docs/mask-gradient-smoke.md","reason": "Maintainer-only executable smoke; never loaded by generation roles."},+ {+ "glob": "skills/ppt-master/scripts/docs/advanced-image-motion-smoke.md",+ "reason": "Maintainer-only executable image-and-motion smoke; never loaded by generation roles."+ },{"glob": "skills/ppt-master/scripts/docs/update_spec.md","reason": "Maintainer command reference for an optional helper script."diff --git a/skills/ppt-master/scripts/svg_finalize/align_embed_images.py b/skills/ppt-master/scripts/svg_finalize/align_embed_images.pyindex d30ed99d..5c7bd466 100644--- a/skills/ppt-master/scripts/svg_finalize/align_embed_images.py+++ b/skills/ppt-master/scripts/svg_finalize/align_embed_images.py@@ -31,6 +31,7 @@ The merged pipeline:if href starts with data: → skip (already inline)if href is unresolvable / external URL → skipif href points to EMF/WMF → skip (native PPTX passthrough only)+ if image belongs to a valid nested crop → preserve source pixels, embedif missing preserveAspectRatio → just embed (do not assume meet)if align == none → just embed (no spatial transform)if mode == slice → crop in memory, embed cropped bytes@@ -79,6 +80,9 @@ if __package__ in {None, ''}:from .crop_images import crop_image_to_size, get_crop_anchor, parse_preserve_aspect_ratiofrom .embed_images import _optimize_image_bytes, get_mime_typefrom .fix_image_aspect import calculate_fitted_dimensions+from svg_to_pptx.drawingml.elements import ( # noqa: E402+ parse_project_nested_svg_crop,+)if TYPE_CHECKING: # pragma: no coverfrom PIL import Image as PILImage # noqa: F401@@ -316,6 +320,20 @@ def _set_href(image: ET.Element, value: str) -> None:image.set('href', value)+def _nested_crop_image_ids(root: ET.Element) -> set[int]:+ """Return child image identities from valid nested crop transports."""+ image_ids: set[int] = set()+ for elem in root.iter(f'{{{SVG_NS}}}svg'):+ if elem is root:+ continue+ try:+ crop = parse_project_nested_svg_crop(elem)+ except ValueError:+ continue+ image_ids.add(id(crop.image))+ return image_ids++def _process_one_image(image: ET.Element,svg_dir: Path,@@ -323,6 +341,7 @@ def _process_one_image(compress: bool,max_dimension: int | None,image_scale: float,+ preserve_source_pixels: bool,verbose: bool,) -> tuple[bool, str | None]:"""Align (slice/meet) and embed a single <image>.@@ -447,12 +466,18 @@ def _process_one_image(new_h = new_h_calctarget_box_w, target_box_h = new_w, new_h- target_w, target_h = _target_size(- target_box_w,- target_box_h,- max_dimension=max_dimension,- image_scale=image_scale,- )+ if preserve_source_pixels:+ # The child's 1×1 box is source-unit crop geometry, not its rendered+ # frame. Keep the full source raster so the outer viewport remains+ # authoritative and independently shaped crops do not lose detail.+ target_w, target_h = final_img.size+ else:+ target_w, target_h = _target_size(+ target_box_w,+ target_box_h,+ max_dimension=max_dimension,+ image_scale=image_scale,+ )final_img, resized = _downscale_to_target(final_img, target_w, target_h)transformed = transformed or resized@@ -463,7 +488,7 @@ def _process_one_image(final_img,img_path,compress=compress,- max_dimension=max_dimension,+ max_dimension=None if preserve_source_pixels else max_dimension,fallback_bytes=raw_bytes if not transformed else None,)if encoded is None:@@ -483,7 +508,10 @@ def _process_one_image(del image.attrib['preserveAspectRatio']if verbose:- suffix = ' (cropped)' if transformed else ''+ if preserve_source_pixels:+ suffix = ' (nested crop, source pixels preserved)'+ else:+ suffix = ' (cropped)' if transformed else ''print(f' [OK] {img_path.name}{suffix}')return True, None@@ -541,6 +569,7 @@ def align_and_embed_images_in_svg()return (0, 1)root = tree.getroot()+ nested_crop_image_ids = _nested_crop_image_ids(root)# Avoid double-iteration if an element matches both namespaced and# bare-tag iteration paths.@@ -561,7 +590,9 @@ def align_and_embed_images_in_svg(ok, err = _process_one_image(image, svg_dir,compress=compress, max_dimension=max_dimension,- image_scale=image_scale, verbose=verbose,+ image_scale=image_scale,+ preserve_source_pixels=ident in nested_crop_image_ids,+ verbose=verbose,)if ok:processed += 1diff --git a/skills/ppt-master/scripts/svg_to_pptx/animation_config.py b/skills/ppt-master/scripts/svg_to_pptx/animation_config.pyindex 8f78cae5..8f4a8d49 100644--- a/skills/ppt-master/scripts/svg_to_pptx/animation_config.py+++ b/skills/ppt-master/scripts/svg_to_pptx/animation_config.py@@ -17,6 +17,7 @@ from pptx_animations import (ANIMATION_RESTARTS,ANIMATION_TIMING_OPTION_FIELDS,ANIMATION_TRIGGERS,+ animation_effect_supports_bounce_end,animation_seconds_to_milliseconds,normalize_animation_effect,normalize_animation_effect_options,@@ -30,6 +31,7 @@ from pptx_transitions import ()from .drawingml.utils import SVG_NS+from .pptx_package.narration import AUDIO_CONTENT_TYPESfrom .semantic_markers import is_static_page_frame@@ -370,11 +372,7 @@ def _animation_parameter_errors(errors.append(f'animations.json {label} sound must be a non-empty path string')- elif sound_is_path and Path(sound).suffix.lower() not in {- '.m4a',- '.mp3',- '.wav',- }:+ elif sound_is_path and Path(sound).suffix.lower() not in AUDIO_CONTENT_TYPES:errors.append(f'animations.json {label} sound must use .m4a, .mp3, or .wav')@@ -761,6 +759,7 @@ def validate_animation_config_errors(config: dict[str, Any]) -> list[str]:_animation_scope_errors(slide_cfg, f'slide "{slide_name}"'))errors.extend(_animation_group_errors(slide_name, slide_cfg))+ errors.extend(_resolved_bounce_support_errors(config))return list(dict.fromkeys(errors))@@ -904,6 +903,160 @@ def _animation_group_errors(return errors+def _bounce_support_error(+ animation: dict[str, Any],+ label: str,+) -> str | None:+ """Return a writer-equivalent bounce support error for one resolved scope."""+ bounce_end = animation.get('bounce_end')+ if (+ isinstance(bounce_end, bool)+ or not isinstance(bounce_end, (int, float))+ or not math.isfinite(float(bounce_end))+ or float(bounce_end) <= 0+ ):+ return None+ try:+ effect, options = normalize_animation_effect_request(+ animation.get('effect', 'auto'),+ animation.get('effect_options'),+ allow_none=True,+ allow_modes=True,+ )+ except ValueError:+ return None+ if effect is None or effect in ANIMATION_MODES:+ return None+ if animation_effect_supports_bounce_end(effect, options):+ return None+ return (+ f'animations.json {label} effect {effect!r} has no behavior that '+ 'supports bounce_end'+ )+++def _resolved_bounce_support_errors(config: dict[str, Any]) -> list[str]:+ """Validate effective bounce/effect pairs after sidecar inheritance."""+ defaults = config.get('defaults', {})+ default_animation: dict[str, Any] = {'effect': 'auto'}+ if isinstance(defaults, dict):+ value = defaults.get('animation', {})+ if isinstance(value, dict):+ default_animation.update(value)++ errors: list[str] = []+ default_error = _bounce_support_error(default_animation, 'defaults animation')+ if default_error:+ errors.append(default_error)++ slides = config.get('slides', {})+ if not isinstance(slides, dict):+ return errors+ relevant_fields = frozenset({'effect', 'effect_options', 'bounce_end'})+ for slide_name, slide_cfg in slides.items():+ if not isinstance(slide_cfg, dict):+ continue+ slide_animation = dict(default_animation)+ slide_value = slide_cfg.get('animation', {})+ if isinstance(slide_value, dict):+ slide_animation.update(slide_value)+ if relevant_fields & set(slide_value):+ error = _bounce_support_error(+ slide_animation,+ f'slide "{slide_name}" animation',+ )+ if error:+ errors.append(error)++ groups = slide_cfg.get('groups', {})+ if not isinstance(groups, dict):+ continue+ for group_id, group_cfg in groups.items():+ if (+ not isinstance(group_cfg, dict)+ or not relevant_fields & set(group_cfg)+ ):+ continue+ group_animation = dict(slide_animation)+ if 'effect' in group_cfg:+ group_animation['effect'] = group_cfg['effect']+ if 'effect_options' in group_cfg:+ group_animation['effect_options'] = group_cfg['effect_options']+ else:+ group_animation.pop('effect_options', None)+ if 'bounce_end' in group_cfg:+ group_animation['bounce_end'] = group_cfg['bounce_end']+ error = _bounce_support_error(+ group_animation,+ f'group "{slide_name}/{group_id}"',+ )+ if error:+ errors.append(error)+ return errors+++def _declared_animation_sounds(+ config: dict[str, Any],+) -> tuple[tuple[str, object], ...]:+ """Return explicitly declared sidecar sound values with scope labels."""+ sounds: list[tuple[str, object]] = []+ defaults = config.get('defaults', {})+ if isinstance(defaults, dict):+ animation = defaults.get('animation', {})+ if isinstance(animation, dict) and 'sound' in animation:+ sounds.append(('defaults animation', animation['sound']))++ slides = config.get('slides', {})+ if not isinstance(slides, dict):+ return tuple(sounds)+ for slide_name, slide_cfg in slides.items():+ if not isinstance(slide_cfg, dict):+ continue+ animation = slide_cfg.get('animation', {})+ if isinstance(animation, dict) and 'sound' in animation:+ sounds.append((f'slide "{slide_name}" animation', animation['sound']))+ groups = slide_cfg.get('groups', {})+ if not isinstance(groups, dict):+ continue+ for group_id, group_cfg in groups.items():+ if isinstance(group_cfg, dict) and 'sound' in group_cfg:+ sounds.append(+ (f'group "{slide_name}/{group_id}"', group_cfg['sound'])+ )+ return tuple(sounds)+++def _animation_sound_path_errors(+ project_path: Path,+ config: dict[str, Any],+) -> list[str]:+ """Validate declared animation sound files against the project root."""+ errors: list[str] = []+ project_root = project_path.resolve()+ for label, raw_sound in _declared_animation_sounds(config):+ if not isinstance(raw_sound, str) or not raw_sound.strip():+ continue+ sound_path = Path(raw_sound)+ if sound_path.suffix.lower() not in AUDIO_CONTENT_TYPES:+ errors.append(+ f'animations.json {label} sound must use .m4a, .mp3, or .wav'+ )+ continue+ if not sound_path.is_absolute():+ sound_path = project_root / sound_path+ sound_path = sound_path.resolve()+ if not sound_path.exists():+ errors.append(+ f'animations.json {label} sound file not found: {sound_path}'+ )+ elif not sound_path.is_file():+ errors.append(+ f'animations.json {label} sound path is not a regular file: '+ f'{sound_path}'+ )+ return errors++def validate_animation_config(project_path: Path,config: dict[str, Any] | None = None,@@ -913,15 +1066,16 @@ def validate_animation_config(Fatal field/type/value checks are owned by:func:`validate_animation_config_errors`. Anonymous groups are warnings;- references to missing slides/groups and structural targets are fatal at- export call sites. Slides omitted from a sparse sidecar inherit defaults.+ references to invalid sound files, missing slides/groups, and structural+ targets are fatal at export call sites. Slides omitted from a sparse+ sidecar inherit defaults."""if config is None:config = load_animation_config(project_path, config_path)if not config:return []- warnings: list[str] = []+ warnings = _animation_sound_path_errors(project_path, config)targets_by_slide, anonymous_groups = scan_project_targets(project_path)for item in anonymous_groups:warnings.append(f'{item} has no id and cannot be customized in animations.json')diff --git a/skills/ppt-master/scripts/template_fill_pptx/checker.py b/skills/ppt-master/scripts/template_fill_pptx/checker.pyindex 8213f361..61cda269 100644--- a/skills/ppt-master/scripts/template_fill_pptx/checker.py+++ b/skills/ppt-master/scripts/template_fill_pptx/checker.py@@ -12,6 +12,7 @@ from .selectors import (_replacement_text,_table_selectors,)+from .transitions import transition_unknown_fieldsdef _slot_lookup(library: dict[str, Any]) -> dict[tuple[int, str], dict[str, Any]]:@@ -291,6 +292,24 @@ def check_plan(library: dict[str, Any], plan: dict[str, Any]) -> dict[str, Any]:for slide_index, slide in enumerate(plan.get("slides", []), start=1):source_slide = int(slide.get("source_slide", 0))+ transition = slide.get("transition")+ if isinstance(transition, dict):+ unknown_transition_fields = transition_unknown_fields(transition)+ if unknown_transition_fields:+ results.append(+ {+ "status": "ERROR",+ "code": "transition_unknown_fields",+ "plan_slide": slide_index,+ "source_slide": source_slide,+ "fields": unknown_transition_fields,+ "message": (+ "transition has unknown field(s): "+ + ", ".join(unknown_transition_fields)+ ),+ }+ )+ summary["error"] += 1replacements = slide.get("replacements", [])if not isinstance(replacements, list):results.append(diff --git a/skills/ppt-master/scripts/template_fill_pptx/transitions.py b/skills/ppt-master/scripts/template_fill_pptx/transitions.pyindex fd5d942a..b59110d1 100644--- a/skills/ppt-master/scripts/template_fill_pptx/transitions.py+++ b/skills/ppt-master/scripts/template_fill_pptx/transitions.py@@ -23,10 +23,23 @@ KEEP_TRANSITION = "keep"# a replacement. The duration is consumed only when a visual effect is written.DEFAULT_TRANSITION = KEEP_TRANSITIONDEFAULT_TRANSITION_DURATION = 0.5+TRANSITION_OBJECT_FIELDS = frozenset(+ {+ "effect",+ "effect_options",+ "duration",+ "advance_after",+ }+)_UNSET = object()+def transition_unknown_fields(raw: dict[str, Any]) -> list[str]:+ """Return unsupported fields from a per-slide transition object."""+ return sorted(set(raw) - TRANSITION_OBJECT_FIELDS)++def _set_slide_transition(slide_root: ET.Element,*,@@ -94,6 +107,11 @@ def _resolve_slide_transition()return effect, effect_options, default_duration, Noneif isinstance(raw, dict):+ unknown = transition_unknown_fields(raw)+ if unknown:+ raise RuntimeError(+ "Transition has unknown field(s): " + ", ".join(unknown)+ )effect = raw.get("effect", default_effect)raw_options = raw.get("effect_options")if raw_options is not None and "effect" not in raw:diff --git a/skills/ppt-master/workflows/native-enhance-pptx.md b/skills/ppt-master/workflows/native-enhance-pptx.mdindex 8d438069..11108f6d 100644--- a/skills/ppt-master/workflows/native-enhance-pptx.md+++ b/skills/ppt-master/workflows/native-enhance-pptx.md@@ -188,12 +188,12 @@ the 1-based `index` in `analysis/slide_index.json`:| `effect: none` | Remove the visual transition; timings remain independently owned || `effect: preserve` | Preserve the source visual transition; narration timing may still update advance |-An explicit `slides` entry always selects that page. With audio disabled,-enabled transitions apply to every page; `apply_without_audio` is ignored. With-audio enabled, that flag extends the global policy from narrated pages to all-pages. If global transitions are disabled, only listed pages opt in; others-preserve source transitions. Morph uses PowerPoint automatic-matching; this route does not rename native objects for deterministic pairs.+A `slides` entry always selects that page. Without audio, enabled global effects+and explicit global `none` apply deck-wide; `apply_without_audio` is ignored.+With audio, the flag extends the global policy from narrated to all pages.+Disabled non-`none` effects preserve unlisted pages. Morph uses PowerPoint+automatic matching; this route does not rename native objects for deterministic+pairs.**Hard rule — no silent downgrade**: a requested native effect must be written with its complete validated Effect Options. Unknown effects or inapplicable options fail; unknown source effects are preserved when the transition module is disabled.diff --git a/skills/ppt-master/workflows/template-fill-pptx.md b/skills/ppt-master/workflows/template-fill-pptx.mdindex 5686ec3e..80af10e7 100644--- a/skills/ppt-master/workflows/template-fill-pptx.md+++ b/skills/ppt-master/workflows/template-fill-pptx.md@@ -196,7 +196,7 @@ The plan structure:| `layout_rationale` | Human review aid for page selection. Include `layout_pattern`, `why_fit`, and `risk`; it is not a mechanical checker gate. || `accepted_warnings` | Optional audit trail for warnings the user or agent explicitly accepts. `check-plan` warnings remain non-blocking; errors must be fixed. || `notes` | Optional spoken speaker notes for the filled slide — see **Speaker notes** below; write prose, not a copy of the on-slide text |-| `transition` | Optional per-slide page transition; overrides the `apply --transition` default. New plans use one canonical native gallery effect from [`animations.md`](../references/animations.md) §3; old names remain read-compatible. Accepts `none` to remove the visual effect, `keep` to preserve the source, or an object such as `{ "effect": "push", "effect_options": { "direction": "left" }, "duration": 0.6, "advance_after": 5 }` |+| `transition` | Optional per-slide page transition; overrides the `apply --transition` default. New plans use one canonical native gallery effect from [`animations.md`](../references/animations.md) §3; old names remain read-compatible. Accepts `none` to remove the visual effect, `keep` to preserve the source, or an object containing only `effect`, `effect_options`, `duration`, and `advance_after`, such as `{ "effect": "push", "effect_options": { "direction": "left" }, "duration": 0.6, "advance_after": 5 }`. `check-plan` and `apply` reject unknown object fields. || `replacements` | Target by `slot_id` whenever possible; `shape_id` and `shape_name` are fallback selectors || `table_edits` | Optional native table cell edits; target by `table_id` whenever possible and use zero-based `row` / `col` || `chart_edits` | Optional native chart data edits; target by `chart_id`, set `categories`, and provide one or more `series` |