Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Manipulating Images (height and width)

by Jeppe (Monk)
on Sep 09, 2002 at 10:55 UTC ( [id://196207]=note: print w/replies, xml ) Need Help??


in reply to Manipulating Images (height and width)

For the sake of the quality, I highly recommend you use GD or ImageMagick for scaling. You CAN do this using the height and width of the image tag in your HTML, but then the images will be at the mercy of the resizer within the end-user browser.

More importantly, you should make sure you maintain the h/w ratio when you scale an image. Otherwise, people will get flat faces and other unwanted artifacts.

For moral strength, you should also consider auto-converting to PNG graphics.

  • Comment on Re: Manipulating Images (height and width)

Replies are listed 'Best First'.
Re^2: Manipulating Images (height and width)
by Aristotle (Chancellor) on Sep 09, 2002 at 11:47 UTC
    Not only do you jeopardize the image quality, there's another much more important point: filesizes. Why send an 80kb 400x400 image scaled to 40x40 with IMG attributes when a real 40x40 one would be 4kb? Even visitors using cable are no counter argument: someone has to pay for the bandwidth on the server side..

    Makeshifts last the longest.

      Why send an 80kb 400x400 image scaled to 40x40 with IMG attributes when a real 40x40 one would be 4kb?

      One possible reason is if the 400x400 image is expected to be viewed later. Why send 4kb 100 times and then 80kb 95 times when sending 80kb 100 times will do? In your example, this justification would only work if the larger image were requested about 95% of the time (though that would still win with protocol overhead) but, with different images, that ratio could be a lot lower. There is no substitute for traffic analysis.

      Another reason might be because generating thumbnails on the fly is expensive in terms of both CPU and time. You might argue that one should then generate the smaller images ahead of time but that approach could be costly in terms of disk and, perhaps more importantly, maintenance issues. These problems could be compounded by the need for multiple thumbs of different sizes.

      Having many ways to do things is so desirable because which of those ways is best usually depends on the problem at hand.

      -sauoq
      "My two cents aren't worth a dime.";
      

        You do have a point. In theory. I haven't run across a case in practice yet where you could expect both the scaled down and original size image to be viewed with that kind of certainty.

        As for thumbnails, I am on a slowish connection and I consider it rude if someone is too lazy to put up scaled down thumbs to serve; more than likely I'm not going to bother waiting for the gallery to load.

        The only case where it is realistically sensible to use IMG attributes is when the same image is used in various scaling factors on the same page - which is usually the scaled transparent pixel scaler..

        Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://196207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-25 07:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found