oakmac / chessboardjs

JavaScript chessboard
https://chessboardjs.com
MIT License
2k stars 406 forks source link

Export board to an image (png or jpeg) #221

Open slolo2000 opened 3 years ago

slolo2000 commented 3 years ago

Hello,

Do you think it could be useful to have a method to export chess board to an image (png or jpeg) ?

I think it should be quite easy to do with a 'canvas" and its "toDataURL" method.

Let me know if you would be interested and if you think it could be add to the main repo and I will try to do it.

Thanks in advance for your answer and have a nice day.

hcgreier commented 1 year ago

Hi slolo2000,

I am currently working on something for private purposes, I would like to enter chess problems and then export them as graphics. My project isn't quite finished, but have a look at html2canvas, the script can render div tags of a web page in PNG graphics.

https://html2canvas.hertzen.com/

greets, hc

hcgreier commented 1 year ago

Hi slolo2000,

you can also look for "DOM to Image" repository: https://github.com/tsayen/dom-to-image

This can also export JPG files. greets, hc