Open ducan-ne opened 1 month ago
npm:canvas seems like already supported this
import fs from 'node:fs'
import { createCanvas, loadImage } from 'canvas'
const canvas = createCanvas(1080, 1080)
const ctx = canvas.getContext('2d')
// Draw cat with lime helmet
loadImage('scripts/test-svg.svg').then((image) => {
ctx.drawImage(image, 0, 0)
fs.writeFileSync('scripts/test-svg.png', canvas.toBuffer('image/png'))
})
Same here. I also get this in the console:
cannot append child nodes to this element.
can't render image: load image failed
With this given svg file that contains a
<image>
element, @napi-rs/canvas currently render blank but it should be the image instead, not sure it's a bug or not yet implemented thoughActual (browser render)![CleanShot 2024-07-22 at 09 51 10@2x](https://github.com/user-attachments/assets/7d7ce042-90a4-4726-884e-e61d55fc09c4)
As is:![CleanShot 2024-07-22 at 09 51 35@2x](https://github.com/user-attachments/assets/7eda348e-19d0-4040-bb6d-6d7578a46720)