Exporting Voronoi Stipplings

Hello again. I’ve forked the wonderful Obama Voronoi Stippling portrait and made a variation with a photograph of myself with my wife. I’d like to export a copy of the canvas and have a print made as a Christmas present (Don’t tell her!). Is there a way to do that? The saving-svg tricks I’ve tried aren’t working.

I suspect this is a feature others would like to take advantage of. If it is possible, I’d appreciate it if you didn’t blast the portrait I’ve made outside this forum, just because I wouldn’t want her to find out about it before I give the gift.

Thanks in advance.

1 Like

How charming! Pretty easy fix: this notebook is using Canvas, not SVG, so you don’t need to do anything fancy to download the image. You can either right-click the image to save it, or you can use canvas.toBlob as shown here:

Thank you. Is there a way to export it out as a vector so I can scale it larger?

Give me a few hours, I’m commuting and this is as good an the cutest excuse to implement that feature on my fork as any ever :stuck_out_tongue:

Sure. You can change the width and height of the Canvas to be whatever you want. Or, you could redefine the portrait cell to generate SVG instead of Canvas, and then use @mbostock/saving-svg’s serialize to download the SVG file. (I also changed it to only render once at the end, since rendering the intermediate state just makes rendering slower…)

1 Like

So I didn’t implement SVG just yet (going to look at that notebook by @mbostock in a bit) because I got too distracted playing around with tweaking values to generate a stippled image that looks nice :stuck_out_tongue:

I hope you like the results:

It uses white dots on a black background - in the browser the points are scaled away, try saving the higher resolution image to see what it would look like.


Wow. Very cool. Thank you! Had a busy week traveling at work. Jumping back on this project today.

The finished product. Not yet wrapped.


Aww, she’s going to love that for sure! :blush: