Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts

    image size impact

    Hi,

    Say I have an image called 'logo.png' that is 200 * 200 pixel but it shall actual be shown as 150*150. How expensive is it to set the size in html (like below)? I am guessing the browser now has to resize the image before showing it to the user. Obviously another approach would be to resize the actual 'logo.png' file. Are there any guidelines regarding using width and height one images in html?

    Code:
    <img src="logo.png" width="150" alt="" />
    Thanks for any help

  • #2
    Regular Coder
    Join Date
    Apr 2011
    Posts
    286
    Thanks
    2
    Thanked 39 Times in 39 Posts
    Not quite sure as to what exactly you are referring to when you say expensive.

    Here are multiple drawbacks in resizing the image with HTML:

    1. The extra bandwidth in hosting a 200x200 image over a 150x150

    2. The browser has to resize the image, and different browsers resize differently, like I believe IE does nearest neighbor, which makes the image look strange. If you resize it yourself, you can make sure that it looks the best it can in all browsers.

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for the feedback.

    Sorry for being unclear, by expensive I meant the time it would take to display the image (for instance, increased cpu or memory usage or bandwidth).

  • #4
    New Coder
    Join Date
    Apr 2011
    Location
    New Delhi, India
    Posts
    27
    Thanks
    0
    Thanked 2 Times in 2 Posts
    resizing image inside html won't make any difference as far as loading is concerned...

    resized 150x150, using width & height attributes, would take same much of time as it would to load 200x200...

    d only difference would be seen in frame 150x150 will be contract as compared to 200x200...

  • #5
    New Coder
    Join Date
    Dec 2010
    Posts
    21
    Thanks
    1
    Thanked 0 Times in 0 Posts
    amitsh: So you do not think the points mentioned by Wojjie are valid?

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by amitsh View Post
    resizing image inside html won't make any difference as far as loading is concerned...

    resized 150x150, using width & height attributes, would take same much of time as it would to load 200x200...

    d only difference would be seen in frame 150x150 will be contract as compared to 200x200...
    No the file size of the resized 150x150 image would be a little less than the 200x200 photo. Over time this adds up. Will the user notice it? Probably not. Will you notice it? Maybe, depends on how much traffic you get daily.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New Coder
    Join Date
    Apr 2011
    Location
    New Delhi, India
    Posts
    27
    Thanks
    0
    Thanked 2 Times in 2 Posts
    hey red_lars

    ofcourse Wojjie points are valid... showing 200x200 image as 150x150 size will add extra bandwidth to server and also secound point too

    resized 150x150 by using software or resized 200x200 into 150x150 image using html will give less or extra load to bandwith... and it also not an issue to concern if u get unlimited bandwidth option from ur hosting com...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •