Skip to content

Reduced number of bytes read in WMF header - #8964

Merged
hugovk merged 1 commit into
python-pillow:mainfrom
radarhere:wmf
May 27, 2025
Merged

hugovk merged 1 commit into
python-pillow:mainfrom
radarhere:wmf

Conversation

@radarhere

@radarhere radarhere commented May 21, 2025 •

Copy link
Copy Markdown
Member

WmfImagePlugin initially reads 80 bytes.

s = self.fp.read(80)

However, the furthest that is used is byte 44.

elif s.startswith(b"\x01\x00\x00\x00") and s[40:44] == b" EMF":

So the number of bytes can be reduced.

@hugovk
hugovk merged commit 90f115c into python-pillow:main May 27, 2025
@radarhere
radarhere deleted the wmf branch May 27, 2025 14:24
@aclark4life aclark4life added the WMF Windows Metafile / Enhanced Metafile (WMF/EMF) label Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WMF Windows Metafile / Enhanced Metafile (WMF/EMF)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants