-
Notifications
You must be signed in to change notification settings - Fork 14k
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
feat: add a config to enable retina quality images in screenshots #17409
feat: add a config to enable retina quality images in screenshots #17409
Conversation
superset/config.py
Outdated
@@ -409,12 +410,13 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]: | |||
# This could cause the server to run out of memory or compute. | |||
"ALLOW_FULL_CSV_EXPORT": False, | |||
"UX_BETA": False, | |||
"SCREENSHOTS_USE_RETINA_HIRES": False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only change in this file... the rest is automated linting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, trailing comma:
"SCREENSHOTS_USE_RETINA_HIRES": False | |
"SCREENSHOTS_USE_RETINA_HIRES": False, |
Codecov Report
@@ Coverage Diff @@
## master #17409 +/- ##
==========================================
- Coverage 77.04% 76.73% -0.32%
==========================================
Files 1041 1042 +1
Lines 56079 56255 +176
Branches 7742 7784 +42
==========================================
- Hits 43204 43165 -39
- Misses 12617 12831 +214
- Partials 258 259 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but what's the workflow here? Doesn't this depend on the device that's loading the screenshot? Is there a way to send both resolutions (1x and 2x) in a report and let the device choose one?
superset/config.py
Outdated
@@ -409,12 +410,13 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]: | |||
# This could cause the server to run out of memory or compute. | |||
"ALLOW_FULL_CSV_EXPORT": False, | |||
"UX_BETA": False, | |||
"SCREENSHOTS_USE_RETINA_HIRES": False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, trailing comma:
"SCREENSHOTS_USE_RETINA_HIRES": False | |
"SCREENSHOTS_USE_RETINA_HIRES": False, |
Yeah, good question, so I'm using the term retina very loosely. It's basically a higher res image. The rendered image size in the html is 1000px, and the slice for example defaults at 3000px wide image capture, which will place a 3x resolution image in the html. For people who are trying to read the image in the email itself, the text will likely be so small that it's unreadable, so they'll opt to open the image as an attachment and zoom in. If you want to take a screenshot at a lower window size so that you can maximize text readability, but still allow people to zoom into the image (some email applications allow you to zoom in in the html and some force you to download the attachment, while some don't let you zoom in at all) then you would set your Another option instead of a feature flag is to make this a config and set it at 1x as a default and allow people to set the ratio themselves. At 2x we're seeing fair quality results but as devices get more pixels (I think we may be up to 4x now) we may want to increase the resolution. But to answer the question, no there's no way (that I know of) with email to let the device decide which one it wants to load. |
0036eea
to
7b183fd
Compare
superset/config.py
Outdated
@@ -1084,7 +1094,8 @@ def SQL_QUERY_MUTATOR( # pylint: disable=invalid-name,unused-argument | |||
WEBDRIVER_TYPE = "firefox" | |||
|
|||
# Window size - this will impact the rendering of the data | |||
WEBDRIVER_WINDOW = {"dashboard": (1600, 2000), "slice": (3000, 1200)} | |||
WEBDRIVER_WINDOW = {"dashboard": ( | |||
1600, 2000), "slice": (3000, 1200), "pixel_density": 1} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only manual change.. the rest is automated linting.
7b183fd
to
1e3ed3c
Compare
So after leaving the last comment, I convinced myself to go with the config route, b/c it will be more flexible. |
1e3ed3c
to
d5af66a
Compare
e568c1a
to
bcaaa19
Compare
bcaaa19
to
42027f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
3954e7d
to
8604cad
Compare
…ache#17409) * add feature flag for retina screenshot support * use config for pixel density * run black (cherry picked from commit 3ee9e11)
🏷️ 2021.46 |
…7409) * add feature flag for retina screenshot support * use config for pixel density * run black
This fixes a portion of #13954 |
SUMMARY
Adding support for configuring image quality for screenshots in both Chrome and Firefox.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Update the config override with a pixel_density of 2. Create a report with an email and check the filesize for a 2x size. It should still be captured at the same width as declared in the config, but at a higher resolution. The email will also display the image at 1000px as per the html.
ADDITIONAL INFORMATION