<body id="slshow_body" style="text-align: center;" >
<h2>Add new sliding image</h2>
<img name="simage1" id="simage1" src=""/>
<br>
<br>
<a href="http://localhost:3000" type="button" class="homepg-btn">Çıkış/Ana sayfa</a>
<script>
window.addEventListener('load', () => {
simage1.src = "http://127.0.0.1:3000/Brother TN-1040 toner.png";
simage1.appendChild("Brother TN-1040 toner");
simage1.appendChild("Price: $100");
})
</script>
Hello js gurus. I’d like to put some text and a picture together to create a new picture in js. I tried using appendChild method as shown in my attached code but I can’t get it to work. When I run the code, all I get is simage1 picture without the text that I want to append. Any help will be appreciated. Thanks.
2
Answers
Try to use jimp npm library. Look at the Jimp.loadFont method.
You are entering a new world of wonders: canvas.
drawImage()
on acanvas
;fillText()
on acanvas
;canvas
"state" as an image withtoDataUrl()
.