Re: [svgwg] naturalWidth and naturalHeight in the context of an HTML image (#1044)

The naturalWidth and naturalHeight as defined in the HTML spec.
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-naturalwidth

> The IDL attributes naturalWidth and naturalHeight must return the [density-corrected natural width and height](https://html.spec.whatwg.org/multipage/images.html#density-corrected-intrinsic-width-and-height) of the image, in [CSS pixels](https://drafts.csswg.org/css-values/#px), if the image has [density-corrected natural width and height](https://html.spec.whatwg.org/multipage/images.html#density-corrected-intrinsic-width-and-height) and is [available](https://html.spec.whatwg.org/multipage/images.html#img-available), or else 0. [[CSS]](https://html.spec.whatwg.org/multipage/references.html#refsCSS)


which is explained in 

> To determine the density-corrected natural width and height of an [img](https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element) element img:
> 
> Let dim be img's [current request](https://html.spec.whatwg.org/multipage/images.html#current-request)'s [preferred density-corrected dimensions](https://html.spec.whatwg.org/multipage/images.html#preferred-density-corrected-dimensions).
> 
> The [preferred density-corrected dimensions](https://html.spec.whatwg.org/multipage/images.html#preferred-density-corrected-dimensions) are set in the [prepare an image for presentation](https://html.spec.whatwg.org/multipage/images.html#prepare-an-image-for-presentation) algorithm based on meta information in the image.
> 
> If dim is null, set dim to img's [natural dimensions](https://drafts.csswg.org/css-images/#natural-dimensions).
> 
> Set dim's width to dim's width divided by img's [current request](https://html.spec.whatwg.org/multipage/images.html#current-request)'s [current pixel density](https://html.spec.whatwg.org/multipage/images.html#current-pixel-density).
> 
> Set dim's height to dim's height divided by img's [current request](https://html.spec.whatwg.org/multipage/images.html#current-request)'s [current pixel density](https://html.spec.whatwg.org/multipage/images.html#current-pixel-density).
> 
> Return dim.




-- 
GitHub Notification of comment by karlcow
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1044#issuecomment-3665238650 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 17 December 2025 12:59:26 UTC