Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

285
Views
How to render "intrinsic" size of element with Dom-To-Image

I'm using tsayen's dom-to-image library to snapshot an image element. The intrinsic size of my image is close to 1000x1000px, but on my website I have it scaled down to about 500x500px. I'm wanting to scale the image back to its intrinsic size before the dom-to-image renders it. This is what I've tried to use:

HTML:

<div class="container" id="node">
   <img class="mz_img" src="/MZ.jpg" />

</div>

JS:

domtoimage
 .toPng(node, {
   style: {
    width: "1100px",
    height: "1256px",
   },
 })

This outputs an almost entirely back 1100x1256 image, with my "mz_img" image displaced almost completely out of frame. I've tried about five different ways for scaling up the image before render, and they all produce completely unpredictable (and unusable) results. What's the best method for scaling up an image before render?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!