Open burghoff opened 2 weeks ago
If there was a way to specify the DPI during the load, that would probably solve the issue.
You can already do this for WMF images. At https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#wmf-emf, it mentions that you can
from PIL import Image
with Image.open("drawing.wmf") as im:
im.load(dpi=144)
It will only work for WMF images at the moment, but if that's all you're after, we can extend it to work for EMF images as well.
I've created #8536 to resolve this by adding that feature for EMF images.
Thanks!
What did you do?
Export WMFs and EMFs as PNGs using the following script:
For some files, namely smaller EMFs and WMFs, the export quality is poor. These are files that look good in vector viewers like Powerpoint, Inkscape, or Illustrator.
tests.zip
What actually happened?
It appears that the image is being loaded at a very low resolution to start with, and then looks bad due to upscaling. If there was a way to specify the DPI during the load, that would probably solve the issue.
What are your OS, Python and Pillow versions?