title: Fabric JS - Can i save canvas as image but with background from <img> tag?
body: <p>I put the <strong>canvas</strong> element in the <strong>div</strong> and the <strong>img</strong> element for the background. Of course I can use <code>canvas.toDataURL('image/png')</code>, but that only saves all objects that are inside the canvas element, I want to save everything in <code>div id=&quot;custom-cloth&quot;</code> as image, how to do this?</p>
  <p>for example code</p>
  <pre><code>&lt;div id=&quot;custom-cloth&quot;&gt;
  
          &lt;!-- Tshirt Image --&gt;
          &lt;div class=&quot;w-full h-[38rem] overflow-hidden&quot;&gt;
              &lt;img id=&quot;img&quot; src=&quot;http://sakaw.test/storage/editor/depan.png&quot; class=&quot;mx-auto&quot;&gt; &lt;--- Here is the background
          &lt;/div&gt;
  
          &lt;!-- Canvas --&gt;
          &lt;div
              class=&quot;absolute top-20 inset-x-0 w-[17rem] h-[30.5rem] mx-auto border-2 border-dashed border-transparent rounded-lg hover:border-orange-500&quot;&gt;
              &lt;canvas id=&quot;c&quot;&gt;&lt;/canvas&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  </code></pre>
  <p>Output code displayed</p>
  <p><a href="https://i.stack.imgur.com/fi8wy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fi8wy.png" alt="Screenshot" /></a></p>
  <p>sorry I'm not good at explaining</p>