Skip to content

fix(image): "saturation" writes a:satMod as a child of a:blip, so nothing applies it #723

In review

Description

@naohito2000

An image's saturation has no effect. A cover slide built with "saturation": -100 came out in full colour.

Repro

One image on a slide:

{"type": "image", "src": "images/cover.jpg", "x": 0, "y": 0,
 "width": 1920, "height": 1080, "fit": "cover", "saturation": -100}

generate_pptx, then ppt/slides/slide1.xml:

<a:blip r:embed="rId2"><a:satMod val="0"/></a:blip>

No a:grayscl anywhere in the part. Converted with LibreOffice 26.8.3.1 to PDF, the picture keeps its colours. Replacing the key with "duotone": ["#000000", "#FFFFFF"] on the same slide renders neutral grey, so the pipeline and the image are fine — only this key is.

Built at c052b173.

Where

sdpm/sdpm/utils/image.py:148-163 adds a:satMod straight to a:blip:

sat_mod = etree.SubElement(blip, qn('a:satMod'))
sat_mod.set('val', str(int(sat_pct * 1000)))

a:satMod is a colour transform. In ECMA-376 it is a child of a colour element (a:srgbClr, a:schemeClr, …), not of a:blip. What a:blip accepts are the blip effects — alphaBiLevel, alphaCeiling, alphaFloor, alphaInv, alphaMod, alphaModFix, alphaRepl, biLevel, blur, clrChange, clrRepl, duotone, fillOverlay, grayscl, hsl, lum, tint — and satMod is not one of them, so a renderer has nothing to apply it to.

The comment two lines above says the intent was to wrap it:

# Use satMod inside colorChange for cross-platform compatibility
# (a:hsl is not reliably supported on macOS PowerPoint)

Nothing wraps it; it is appended to blip.

The key is documented in sdpm/references/guides/slide-json-media.md as
saturation: saturation adjustment (-100=monochrome, 0=no change, 100=vivid), so a composer
following the guide gets silence rather than a warning.

Fix

-100 is the common case and has an exact blip effect: emit <a:grayscl/>.

Intermediate values need a decision, which is why this is not a one-line change. a:hsl is the
blip effect for them, and the comment above records that it was avoided for macOS PowerPoint. If
that still holds, the choices are to accept only -100 and warn on other values, or to
approximate with a:duotone between two greys. Whichever is chosen, the element written today
should go, because it silently does nothing.

Activity

  1. added
    bug
    on Dec 3, 2026
  2. ShotaroKataoka commented on Dec 3, 2026

    @ShotaroKataoka
    Contributor

    🤖 KiroCrew automated comment (triage, not a maintainer decision)

    Thanks @naohito2000 for the clear report and the pointer to the dead comment.

    Confirmed on main (c43f773). A deck with "saturation": -100 writes <a:blip r:embed="rId2"><a:satMod val="0"/></a:blip>. Validating slide1.xml against the ISO/IEC 29500 pml.xsd gives exactly one error: a:satMod: This element is not expected inside CT_Blip. tests/test_image_effects.py::test_saturation_is_a_sat_mod pins the wrong element, so it needs to change with the fix.

    If you are not planning to pick this up yourself, it looks like a good first issue for a new contributor: small, one file, clear before/after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions