Open dirkschulze opened 10 years ago
@dirkschulze I'm not entirely sure what you're hoping for here. Generator's getPixmap
can be used to get rasterized data. That can be converted to a PNG with savePixmap
(e.g. to a temp file), and then base64-encoded with standard node functions.
We could certainly add a streaming implementation of this (so that you didn't have to make a temp file). That would simply entail changing the convert library functions to allow piping the output of convert back to node rather than to a file.
Is that all you want?
I am looking into getting these information from Generator with using as less JSX in the project as possible. (Hopefully none at all.) I'll checkout getPixmap.
@dirkschulze It should be totally possible. You can do something like piping output of png (but preferably directly getPixmap
, if streaming alternative gets implemented) into base64 convertor and finally somewhere to your place. Temp files sometimes make it easier to use some external libraries, but there is quite ofter stream alternative
@dirkschulze Just FYI, @isonno 's SVG code contains a way to get base64-encoded versions of layers. Perhaps he can fill you in on that.
The "correct" way to do this is 1. finish the streaming implementation of the pixel pipeline, and 2. write a bit of code that wraps getPixmap and base64-encodes the result. I'll leave this bug open with the intent of doing that someday. :smile:
At the moment, images or pixel content are not exported. Export to PNG encoded as base64 would be great.