Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow loading of WMF images at a given DPI #4311

Merged
merged 2 commits into from
Dec 29, 2019

Conversation

radarhere
Copy link
Member

Resolves #4223

WmfImagePlugin can load both WMF and EMF files. When loading WMFs, it sets the DPI to 72. This is an arbitrary number, because WMFs are like SVGs - they don't have an intrinsic DPI, and can be scaled to any resolution. The Python code just tells the C code what size is required.

This PR suggests that after opening an WMF file, but not an EMF, the following code be used to set the DPI to 144, for example, by adding a dpi argument to WmfImagePlugin load -

with Image.open("Tests/images/drawing.wmf") as im:
    im.load(144)

Feel free to suggest an alternative API.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Let's also update the docs and add to release notes.

@radarhere
Copy link
Member Author

radarhere commented Dec 29, 2019

I've updated the documentation and added it to the release notes - I've moved WMF from identify-only into read-only. The Windows read functionality was actually added in PIL 1.1.17, but I've removed the references to PIL versions.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

Perhaps add .. code-block:: python to the code blocks, merge when you're ready.

@radarhere
Copy link
Member Author

Okay, done.

@radarhere radarhere merged commit 2a0653e into python-pillow:master Dec 29, 2019
@radarhere radarhere deleted the wmf branch December 29, 2019 23:25
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.

wmf file to bitmap was forced to 72 dpi
2 participants