0

I created an interactive worldmap with the threejs package and while the map is fantastic I need images from it for a presentation. The final object is a htmlwidget, I can save a very low res image with webshot, but I would like one with a higher resolution. The map itself is really nice resolution wise, but I cannot save stills.

I tried the following:

saveWidget(plot, "temp.html")

webshot("temp.html", "temp.jpg", zoom = 2, vwidth = 441, vheight = 351)

Unfortunately the resulting image (can also be a png or pdf) is very low quality. I tried screenshots, no avail. I am open to any option also outside R.

H.Stevens
  • 391
  • 3
  • 16
  • Try **svg**. There are free online converters, such as [this one](https://convertio.co/fr/html-svg/). – Stéphane Laurent Apr 08 '22 at 12:02
  • What package or functions did you use to create the widget? Each package that uses `htmlwidgets` has different elements and criteria specified in how it's rendered. – Kat Apr 09 '22 at 19:15
  • I used the threejs package. Its an interactive globe. – H.Stevens Apr 11 '22 at 06:22
  • I think I know the problem, but I'd like you to confirm that this is the case for your saved HTML file. Right now, when you use `saveWidget` with `threejs` it's adding height, width, and fill: true <- that essentially means ignore the aspect ratio. That would definitely be a problem. Could you check to see if that's the problem? If it is, I think I can offer a few different ways to fix it. (I just didn't want to run down that rabbit hole if I'm way off.) – Kat Apr 12 '22 at 22:52
  • `fill` in this context is a JS-ish things. (`htmlwidgets` are said to use JS, but it's not quite JS, it's like JS-ish.) Where `fill` in CSS or CSS inline in HTML means ignore the aspect ratio, that's not what this means here. I've noticed that the plot view in the viewer pane is not like the browser. Have you viewed this in your browser before saving? Another option is to save it overly large and shrink it when you use it. That will inherently improve the resolution. I haven't duplicated your issue, though. So, it's hard to say what's going on. – Kat Apr 12 '22 at 23:41

0 Answers0