Generate an Image and Get Its Size in JavaScript

November 2025

This is a test to see about using html2canvas to generate an image from an element on a page and then determine its size.

HTML

<script src="/neo-files/theme-files/scripts/html2canvas/html2canvas.min.js"></script>

<div class="input">this is the input</div>

<div class="output"></div>

Output

this is the input
end of line

Endnotes

The idea here is to be able to automate part of the process of figuring out how tall the baseline characters are for different fonts. Something I'm doing for fonts.alanwsmith.com