-
Notifications
You must be signed in to change notification settings - Fork 156
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
Previews: support creating thumbnails and full-height screenshots #312
Conversation
src/browser/browser.ts
Outdated
@@ -230,10 +248,27 @@ export class Browser { | |||
this.log.debug('Taking screenshot', 'filePath', options.filePath); | |||
} | |||
|
|||
if (options.fullPageImage) { | |||
this.log.debug('TODO: take full screen image', 'url', options.url); |
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.
@ArturWierzbicki -- how involved was this process? If easy to port, can we try that?
@@ -1,3 +1,6 @@ | |||
## 3.4.0 (--) | |||
- Support full height dashboards and scaled thumbnails [#312](https://github.com/grafana/grafana-image-renderer/pull/312) |
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.
@AgnesToulet what is the process for documenting the changes here?
The behavior changes are:
- negative scale will create a scaled down thumbnail
- height=-1 will create an image as tall as it needs to be based on the webpage size
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.
The documentation for the image renderer is in the grafana repo: https://github.com/grafana/grafana/blob/main/docs/sources/image-rendering but we don't really have documentation on how to call the image renderer (more on how to configure and run it).
I guess we could add a section in the main file or a new file for that. @achatterjee-grafana Do you have any opinion on that?
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.
Sounds good @AgnesToulet. Let me know if you need any help.
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! Left a couple of questions and suggestions but all very subjective and nothing major.
Also, I wonder if it would be worth to support the full page option without the dashboard being in kiosk mode (right now, dashboards can be a bit cut at the end without the kiosk mode).
@AgnesToulet fixed non-kiosk mode in efa7e73 |
71be323
to
f01214f
Compare
There is still one issue reported by
Which is weird, because Sharp requires NAPI version >= 5 which is supported by node 14/16: https://nodejs.org/api/n-api.html#n_api_node_api_version_matrix |
The only way I found to make it work is to manually copy sharp binary/ I also had to pin |
Packaging on M1 MacOS doesn't work, neither on this branch (because 2.6.x |
Tested on Windows x64 with CI-built binary https://app.circleci.com/pipelines/github/grafana/grafana-image-renderer/464/workflows/8d39e08f-a376-4d41-8c23-62b4f80c5562/jobs/1864/artifacts - works |
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! Thanks for the fix for sharp library. Left a few very minor suggestions and one comment to make the scripts work on Windows (the priority is to make it work on Linux but if, with some tweaks, we can make it work on both, it would be great!)
…ana-image-renderer into scaled-thumb-result
Co-authored-by: Agnès Toulet <[email protected]>
Co-authored-by: Agnès Toulet <[email protected]>
Co-authored-by: Agnès Toulet <[email protected]>
This PR updates the image renderer to support creating thumbnails from a requested page. Rather than adding a new parameter, this is reusing the scale/deviceScaleFactor parameter and using negative numbers.
For the request:
http://localhost:3000/render/d/zNigXIonz/heatmap?kiosk&orgId=1&width=320&height=240&scale=-5
It will render an image a 320*5 and then scale it back down to 320px: