How to get the original image size (width and height) using JavaScript

Today we will show you how to get the original image size (width and height) using JavaScript. In the previous article, we have explained how to get current image size.

You can use the naturalWidth and naturalHeight to get the current width and height of the image in pixel.

Refer to the sample HTML code below to get the image size.

Using the code above you will find the width and height of the original image in the console.

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *