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

wmf file to bitmap was forced to 72 dpi #4223

Closed
FrankLiu007 opened this issue Nov 21, 2019 · 6 comments · Fixed by #4311
Closed

wmf file to bitmap was forced to 72 dpi #4223

FrankLiu007 opened this issue Nov 21, 2019 · 6 comments · Fixed by #4311

Comments

@FrankLiu007
Copy link

FrankLiu007 commented Nov 21, 2019

What did you do?

I read in an wmf image and then save it as a png image. I found the resolution of the result image is rather low no matter how I set the quality parameters.

When I looking into the source code ( src/PIL/WmfImagePlugin.py), I found the resolution was fixed to 72dpi.

What are your OS, Python and Pillow versions?

  • OS: win10
  • Python: 3.6.8
  • Pillow: 6.1.0
@radarhere

This comment has been minimized.

@FrankLiu007

This comment has been minimized.

@hugovk

This comment has been minimized.

@FrankLiu007
Copy link
Author

FrankLiu007 commented Nov 25, 2019

image2.zip
Lucky, zip is permitted.

@radarhere
Copy link
Member

For now, I think you should be able to use this code to set the size that the image is rendered at, and so effectively, the DPI that is used to create the image -

from PIL import Image
im = Image.open("test.wmf")
im._size = (300, 300)
im.load()

@radarhere
Copy link
Member

I've created PR #4311 to resolve this, by adding a dpi argument to the WmfImagePlugin load method -

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

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 a pull request may close this issue.

3 participants