JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/dom-to-image/2.6.0/dom-to-image.min.js"></script>
<div id="root">


  <div id="bubbleParent">
    <img id="bubble" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7f/Speech_bubble.svg/2560px-Speech_bubble.svg.png">
    <div class="bubble-text" style="text-align: center;">
      <span class="textFitted textFitAlignVert" style="display: inline-block; text-align: center; font-size: 30px; height: 45px;">Enter text</span>
      </div>
  </div>

  <button id="render">
    Render
  </button>

</div>

CSS

#bubbleParent {
    position: absolute;
    width: 25%;
    left: 33.3%;
    top: 30%;
    aspect-ratio: 16 / 9;
}

#bubble {
    width: 100%;
    height: 100%;
    left: 0px;
    top: 0px;
    position: absolute;
}

.bubble-text {
    width: 85%;
    height: 67%;
    position: absolute;
    left: 3%;
    top: 6%;
    color: black;
    z-index: 5;
    margin: 4%;
}

JavaScript

document.getElementById("render").addEventListener('click', function(){
  domtoimage.toPng(document.getElementById("bubbleParent"))
          .then(function (dataUrl) {
              var img = new Image();
              img.src = dataUrl;
              document.getElementById("root").innerHTML = ""
              document.getElementById("root").appendChild(img);
          })
          .catch(function (error) {
              console.error('oops, something went wrong!', error);
  });
})