const svgAsString =
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 95.453 100"><path d="M92.115 56.539c.216-1.638 3.234-4.062 3.332-5.712.175-3-3.879-8.87-6.664-9.997-4.422-1.789-26.896-.952-26.896-.952-2.196-3.84 3.914-13.321 5.594-17.415 2.467-5.999 2.051-13.959-1.069-18.048-3.81-4.996-10.805-5.329-10.949-3.093-1.042 16.214-4.146 20.712-8.302 23.918-2.496 1.926-4.679 3.611-5.83 6.546C34.248 49.824 28.999 54 25.999 54h-2v40.999l20.995 3.905s26.065 2.467 34.272 0c2.582-.774 7.039-4.652 8.092-7.141.602-1.428-.233-4.809.478-6.188 1.049-2.043 5.479-4.602 5.475-7.378-.004-1.979-2.311-5.405-2.143-7.379.167-1.976 4.288-4.685 4.284-6.664-.009-2.076-3.61-5.555-3.337-7.615zM20 93.999a4 4 0 0 1-4 4H4a4 4 0 0 1-4-4V56a4 4 0 0 1 4-4h12a4 4 0 0 1 4 4v37.999z"/></svg>';
const svgBlob = new Blob([svgAsString], {
type: "image/svg+xml"
});
const svgObjectUrl = globalThis.URL.createObjectURL(svgBlob);
const img = document.createElement("img");
const onImageLoaded = () => {
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
context.drawImage(img, 0, 0);
const createdImage = document.createElement("img");
createdImage.src = canvas.toDataURL("image/png");
document.body.appendChild(createdImage);
globalThis.URL.revokeObjectURL(svgObjectUrl);
};
img.addEventListener("load", onImageLoaded);
img.src = svgObjectUrl;
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.