I'm using the Sharp NPM library with Node.JS and I'm trying to add text to my canvas. I found out here that I need to use .overlayWith()
, along with another library that can convert text to an SVG. A comment there suggested to use text-to-svg or vectorize-text, but both of those, along with text2svg, return an SVG. Sharp's .overlayWith()
function requires an image Buffer. How can I convert the SVG that these libraries return, into an image Buffer for Sharp?
Found out the solution: The NPM module SVG2IMG takes an SVG string and converts it into an image Buffer.