How to dump plots as bas64 strings?
On Thu, Mar 5, 2009 at 1:27 PM, Duncan Temple Lang
<duncan at wald.ucdavis.edu> wrote:
Patrick Meyer wrote:
Here's the solution I'm using now, but it is not very "clean":
png("out.png")
plot(c(1,2,3))
dev.off()
system("base64 -w0 out.png > out.base64")
b64txt <- readLines(file("out.base64","rt"))
It would be nice to have an internal solution, even if this exactly does
what I want.
I'm not certain which bit of this you are referring to when you say "internal". ?It would be covenient to have graphics devices be able to write to a buffer as well a ?file and it wouldn't be terribly difficult to do, but hasn't been a big enough problem so far.
I have faced this too, i.e. having to write out plots only read them back in again, and if there are two of us I suspect there are more facing thistoo. I was using a different encoding but that was not a problem in any case, just the annoyance of having to write out files only to read them back in.