Open HenrikBengtsson opened 7 years ago
Notes to self:
Graphics devices do not support using a file connection as output, e.g.
> file <- file("foo.png", open = "wb")
> png(filename = file)
Error in png(filename = file) : invalid 'filename' argument
This means that any compression needs to be done on already created image files. This sounds like a task for the DevEvalFileProduct class.
Some devices support compression, e.g.
> args(tiff)
function (filename = "Rplot%03d.tiff", width = 480, height = 480,
units = "px", pointsize = 12, compression = c("none", "rle",
"lzw", "jpeg", "zip", "lzw+p", "zip+p"), bg = "white",
res = NA, ..., type = c("cairo", "Xlib", "quartz"), antialias)
How should selective compression be done? That is, we typically only want to compress for certain types, e.g.
res <- devEval(c("png", "svg", "x11", "eps")), name = "foo", plot(1:3) })
Could we use a compression = FALSE
(none), compression = TRUE
(all), compression = c("svg", "eps")(only SVG and EPS extensions), and
compression = NA` (default set of extensions that we typically want to compression; possibly set via an option).
Some image file formats such as EPS, Postscript and SVG can be significantly compressed. It would be handy if one could compress the output files on the fly using, say, gzip compression.
Some ideas:
These should then all output a
foo.svg.gz
file.