MDN self-hosted library · e01.org

HTMLImageElement: Image() constructor

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const myImage = new Image(100, 200);
myImage.src = "picture.jpg";
document.body.appendChild(myImage);
html
<img width="100" height="200" src="picture.jpg" />