agg_webp_anim | R Documentation |
The WebP format is a raster image format that provides improved lossless (and lossy) compression for images on the web. Transparency is supported.
agg_webp_anim(
filename = "Ranim.webp",
width = 480,
height = 480,
units = "px",
pointsize = 12,
background = "white",
res = 72,
scaling = 1,
snap_rect = TRUE,
lossy = FALSE,
quality = 80,
delay = 100L,
loop = 0L,
bg
)
filename |
The name of the file. This function does not perform page number substitution as the other devices since it cannot produce multiple pages. |
width , height |
The dimensions of the device |
units |
The unit |
pointsize |
The default pointsize of the device in pt. This will in general not have any effect on grid graphics (including ggplot2) as text size is always set explicitly there. |
background |
The background colour of the device |
res |
The resolution of the device. This setting will govern how device dimensions given in inches, centimeters, or millimeters will be converted to pixels. Further, it will be used to scale text sizes and linewidths |
scaling |
A scaling factor to apply to the rendered line width and text
size. Useful for getting the right dimensions at the resolution that you
need. If e.g. you need to render a plot at 4000x3000 pixels for it to fit
into a layout, but you find that the result appears to small, you can
increase the |
snap_rect |
Should axis-aligned rectangles drawn with only fill snap to the pixel grid. This will prevent anti-aliasing artifacts when two rectangles are touching at their border. |
lossy |
Use lossy compression. Default is |
quality |
An integer between |
delay |
Per-frame delay in milliseconds (single integer) |
loop |
Number of loops (0 = infinite) |
bg |
Same as |
agg_webp()
for static WebP images
## Not run:
file <- tempfile(fileext = '.webp')
agg_webp_anim(file, delay = 100, loop = 0)
for(i in 1:10) {
plot(sin(1:100 + i/10), type = 'l', ylim = c(-1, 1))
dev.flush()
}
dev.off()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.