Skip to content

fix: distinguish EMF images from WMF - #1158

Open
simpleqt wants to merge 1 commit into
scanny:masterfrom
simpleqt:fix/emf-content-type
Open

simpleqt wants to merge 1 commit into
scanny:masterfrom
simpleqt:fix/emf-content-type

Conversation

@simpleqt

Copy link
Copy Markdown

Pillow reports both WMF and EMF images as "WMF", so Image.ext and Image.content_type return "wmf"/"image/x-wmf" for EMF images. Detect the " EMF" signature at offset 40 and report the format as EMF, which maps to "emf"/"image/x-emf".

Fixes #1042.

pytest tests/parts passes (132 tests).

Pillow reports both WMF and EMF as "WMF", so Image.ext and Image.content_type returned the WMF extension and MIME type for EMF images. Detect the " EMF" signature at offset 40 and map the format to "emf" (image/x-emf).
Copilot AI balanced review requested due to automatic review settings November 30, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

Image.content_type and Image.ext incorrect for EMF files?

2 participants