vg/vgimg: consider adding Image() draw.Image to Canvas
it would be great to be able to retrieve the underlying draw.Image
of a vgimg.Canvas
.
ie:
func (c *Canvas) Image() draw.Image {
return c.img
}
vgimg.Canvas
can be created with an already created draw.Image
(using the UseImage
functional option) but once created there is no efficient way to get back at it. (one very inefficient way is to WriteTo
the canvas to an io.Writer
and png.Decode
-it back...)
I have been using this to create an animated GIF out of a slice of PNG plots.
Directly creating the animated GIF from the draw.Image
images was faster than writing all the PNG files, decoding them back, encoding them to GIF and assembling them as an animated GIF. (d'oh!)
see:
https://github.com/sbinet-lsst/ctrack-plot