Use `window.devicePixelRatio` or similar to request high resolution images. You can do this by doubling the resolution passing an (undocumented?) parameter `res` to png. See [rstudio example](https://github.com/rstudio/rstudio/blob/cfce730f051fbab56a13ff218132f4802dcefdab/src/cpp/r/session/graphics/RShadowPngGraphicsHandler.cpp#L112-L123).