Automatic Image Resizing Checked In
Sunday January 19th, 2003
David Illsley writes: "Yesterday saw the checkin of automatic image resizing (bug 73322) to the Mozilla trunk. When turned on (it's disabled by default) it shrinks any image that is bigger than the window to make the whole image visible. When this is done, the cursor over the image changes to tell you that if you click, the image is restored to full size. You get the best of both worlds! This currently doesn't have a prefs UI in Phoenix but if you put the appropriate pref in you user.js file, it works just fine. This is one of the few features in IE that I have seen and liked and it's great that Moz now has it too. Thanks guys."
To enable this feature in Mozilla, go to Edit > Preferences > Appearance and check the 'Enable automatic image resizing' box. If you're using Phoenix, add the following line to your prefs.js or user.js file:
#32 Performance/other problems analysis
Monday January 20th, 2003 6:38 AM
You are replying to this message
Mozilla always uses nearest-neighbour resizing, rather than a resampling technique.
And no, it wouldn't take up too much memory. Bilinear resampling takes no more memory than nearest-neighbour resizing: you need to store the original image, and space for your new smaller one. (If you were really short of memory you could reduce this by handling it a section at a time, which is true of both techniques but might be simpler for nearest-neighbour.)
It does take more CPU time. Whether this is an issue depends on how many images you are resizing, and how important the resize is.
For example if the browser is viewing a single jpg then obviously the user cares about that image so it should be resized in higher quality, even though (for a large image) this might case a half-second delay. But on a page with dozens of 'thumbnails' that some idiot produced using the full-size image and having the browser resize it, the delay could be more of a problem. (Although we should note that the page is not exactly going to be a fast loader in the first place.)
Another issue is that Web designers may expect image resize to work in a blocky manner; I've done this for a few sites. It can create a cool effect, which would be spoiled if resize became smooth :) That's not really a good reason for it, but..
IMO the best behaviour would be to leave as-is for rendering Web pages using width=, height=, but when the browser is viewing a single image file that is auto-resized, do it properly. It might also be worth doing it properly when the image dimensions are specified using the CSS properties (as that's a convenient 'changeover' point).
By the way I have ignored the hardware acceleration aspect. You *can* use a graphics card's acceleration to resize images smoothly, but this will not be done by default by the Windows API. I suspect it requires DirectX etc. and is probably more trouble than it's worth (as really, bilinear resize is *not* slow for a modern cpu and is probably adequate).