[thelist] Letting the browser resize an image

Roger Ly rogerly at bareviking.com
Wed Jan 29 12:36:01 CST 2003


Thanks for your response, Andrew.

>Browsers, on the other hand all (at the moment) use a 'nearest
neighbour'
>scaling system, which takes the colour of the nearest pixel in the
large
>image and ignores the rest. Which normally results in quite jaggy
images.

Looks like I'll just have to start testing with a bunch of different
images and image types to see what looks good and what looks bad scaled
in the browser.

>> Is it more processor intensive to scale in the browser?
>No, less, but only because the browser uses the simplistic 'nearest
>neighbour'
>algorithm.

Actually, I was curious if it was significantly more processor intensive
for the client machine's browser to display the image at a scaled down
size than to display it at normal size.  I know there will require some
CPU time to scale an image, but I don't want a machine's CPU to be
pegged just because we were making the browser render 10 images at a
scaled size.

>The optimum solution is a have a thumbnail script like:
>  <img src="/scripts/thumb.cgi?image=1234;w=75;h=75" alt="(thumbnail)"
/>
>which you can call to make a new thumbnail of any size you like* on the
fly
>and return it to the browser.

Well, it looks like we'll be generating the thumbnails one time, when
the user uploads the original image.  I'd like to avoid any runtime
scaling of the image just to reduce the overhead on the server the first
time people try to actually view their thumbnails.  It is an interesting
idea though -- I'll keep in mind.

Roger





More information about the thelist mailing list