Convert widgets to PNG image

m_png(id, width, height, captureDelay = 2000)

Arguments

id

R3dmol id or a r3dmol object (the output from r3dmol()).

width, height

image width and height.

captureDelay

Image conversion delay setting. This argument is only needed in some cases where the rendering is time-consuming (e.g. with m_add_surface()). The default value is 2000 milliseconds. Fixed to 0 when immediate rendering available.

Value

Base64 encoded png image wrapped by <img> tag.

Examples

library(r3dmol)

r3dmol() %>%
  m_add_model(data = pdb_1j72, format = "pdb") %>%
  m_set_style(style = m_style_cartoon()) %>%
  m_zoom_to() %>%
  m_png()