Closed nery90 closed 1 year ago
This would be great, and I think I had something in works.
Hi @nery90 ! I've just pushed c0d635d694484bdf5fe488fcb1378c5bf508f742 to master and added SAVE-PNG
. I still need to document it and add parameters for custom width/height, but could you please test it out and let me know if it works for you?
Here's example code:
(defsketch save-png-example ()
(rect 100 100 200 200)
(save-png #p"~/output.png"))
(make-instance 'save-png-example) ; you can just close it after it renders the rect
This will of course save the png every frame, but I'm sure you can find a way around it :)
@vydd , this is great. This is just to say thanks. I'll put this feature to good use.
Dear Dev, first, let me thank you for this fantastic library. At the risk of asking something potentially trivial, I would like to know whether it is possible to save sketches as static images e.g. png. I am a researcher and I am very interested in using Sketch to programatically generate diagrams and graphics to (i) share my research results; and (ii) teach some Computer Science modules. I am new to Lisp, and so, again, I might be asking something very basic. Unfortunately, I could not find an answer to my question by looking at Sketch's source code. Or maybe this is not a correct use case for Sketch? I will be very happy if you could give me some pointers.
Thanks for your efforts.
Nery