QA Graphic

Get Image Size (Using JQuery)

Finding the rendered image size using jQuery

Sometimes the Quality Assurance team needs to get the size of an image that is rendered on a page. Usually, this is to validate that the rendered image meets the specifications.

This will show you what the image actually rendered on the page:

$imageCheck = "Height: " + $('#facebook').height() + " Width: " + $('#facebook').width() ;

If you want to know the actual physical dimensions of the image:

$NaturalCheck = "Natural Height: " + $('#facebook').naturalHeight() + " Natural Width: " + $('#facebook').naturalWidth() ;

Sample Output

Natural Height Check

 

Comments

Add Your Comments

Name:
Comment:

 

About

jQuery is the most popular Javascript library on the Internet. Chances are that websites that your testing use it. These posts are all about tips and tricks for QA testing.

Schedule

Tuesday 22 QA
Wednesday 23 Pytest
Thursday 24 PlayWright
Friday 25 Macintosh
Saturday 26 Internet Tools
Sunday 27 Misc
Monday 28 Media