Skip to content

fix: handle PPTX SVG images without a rasterized fallback#2233

Merged
afourney merged 2 commits into
microsoft:mainfrom
guoyu-wang:user/gwang/pptx-svg-no-raster-fallback
Jul 23, 2026
Merged

fix: handle PPTX SVG images without a rasterized fallback#2233
afourney merged 2 commits into
microsoft:mainfrom
guoyu-wang:user/gwang/pptx-svg-no-raster-fallback

Conversation

@guoyu-wang

Copy link
Copy Markdown
Contributor

PowerPoint stores an SVG picture as an <a:blip> whose r:embed points to a raster PNG fallback plus an asvg:svgBlip extension for the SVG. When a picture has no raster fallback, the <a:blip> has no r:embed, so python-pptx's shape.image raises ValueError("no embedded image"). This caused PptxConverter to fail the entire conversion.

Resolve the SVG part directly from the svgBlip extension via a new _get_image_info helper, and guard _is_picture against the exception (hasattr only swallows AttributeError). Add unit tests plus a small synthetic PPTX fixture covering the SVG-without-fallback case.

PowerPoint stores an SVG picture as an <a:blip> whose r:embed points to a
raster PNG fallback plus an <asvg:svgBlip> extension for the SVG. When a
picture has no raster fallback, the <a:blip> has no r:embed, so
python-pptx's shape.image raises ValueError("no embedded image"). This
caused PptxConverter to fail the entire conversion.

Resolve the SVG part directly from the svgBlip extension via a new
_get_image_info helper, and guard _is_picture against the exception
(hasattr only swallows AttributeError). Add unit tests plus a small
synthetic PPTX fixture covering the SVG-without-fallback case.
@guoyu-wang

Copy link
Copy Markdown
Contributor Author

@guoyu-wang please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree [company="Microsoft"]

@guoyu-wang

guoyu-wang commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

@guoyu-wang please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company=microsoft

@guoyu-wang

Copy link
Copy Markdown
Contributor Author

@guoyu-wang the command you issued was incorrect. Please try again.

Examples are:

@microsoft-github-policy-service agree

and

@microsoft-github-policy-service agree company="your company"

@microsoft-github-policy-service agree company=microsoft

@afourney
afourney merged commit 2e42a01 into microsoft:main Jul 23, 2026
4 checks passed
@guoyu-wang
guoyu-wang deleted the user/gwang/pptx-svg-no-raster-fallback branch July 23, 2026 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants