naturalWidth is the natural width of an element. It never changes.
For example, a 100px wide image always has naturalWidth of 100px even when the image is resized by CSS or JavaScript.width is the value of width attribute. It is subject to change and can be updated via CSS or JavaScript.url:const getNaturalWidth = url => {return new Promise((resolve, reject) => {const img = new Image();img.addEventListener('load', () => {resolve(img.naturalWidth);});img.addEventListener('error', () => reject());img.src = url;});};// UsagegetNaturalWidth('https://path/to/image.png').then((naturalWidth) => {...});