-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add dpi info to saved PNGs, and scale images in reports #246
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #246 +/- ##
==========================================
- Coverage 72.20% 70.75% -1.46%
==========================================
Files 34 34
Lines 9023 9036 +13
==========================================
- Hits 6515 6393 -122
- Misses 2508 2643 +135
... and 7 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
I've tried this on my non-highres Linux laptop. It certainly changes something. If I export a scatterplot as a PNG with the old code I see the following with
And with the new code:
So the new code behaves as specified, but is it really correct? It seems that resolutions was already set properly before. Can you share similar info from a PNG exported on a retina Mac? Otherwise this code does not break anything for me, a non-retina user. |
I get 144x144, as I should. I don't know where your 96 came from. Now that it is changed to 72, some programs might show it larger then before. But to my experience, most either ignore it (e.g. browsers) or it doesn't matter (e.g. Word, Powerpoint, where the user resizes the image anyway). |
With this PR I understand that we get either 72 or 144. But I saw that dpi was saved correctly before on my computer (it is set to 96 dpi), so I wonder if it was also saved correctly on your Mac on master. If it is, I'd remove the dpi-setting code from the png exporter. |
For me, it was always 72. Now, with 144, the saved image has the same size as the original in the widget. I would think that using Could you please investigate this? We need to fix this and I don't have a suitable machine to try it on. |
Sure, I'll look into this. |
Issue
Fixes #240.
Description of changes
report_plot
scales the image (via CSS'zoom
property) if the image writer provides a dict with meta data that includes pixel ratio.image = QImage("x.png"); QApplication.clipboard().setImage(image)
, where "x.png" is a 144 dpi png, the image in the clipboard is twice the size, with 72 dpi. It's no problem, however; the user will usually resize the pasted image to some convenient size.)Includes