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:

user_pref("browser.enable_automatic_image_resizing", true);

Phoenix Help has more information about editing Phoenix configuration files.

#48 Nearest Neigbour

by Paper

Monday January 20th, 2003 11:10 AM

You are replying to this message

> 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.

It's still too much memory, according to the module owners & peers. Take, for example, a 2048x4096 image scaled down to 1024x2048. Original Image = 24M memory. Scaled Image = 6M. Total = 30M. Result = Important people complaining we use way too much memory. Or how about a 1000x500 image scaled to 99%? Now mozilla is using twice the memory it "should" be. A final example, 100x80 image scaled to 800x640. ~1.5M memory used, instead of ~23k. That's 65x the memory usage. Some people only look at numbers, and with those numbers (6M bloat, or 65x memory usage), those people shoot down any chances of caching the scaled image.

>It does take more CPU time.

Unfortunately, _a lot_ more CPU time. Since we don't cache scaled images, we would be re-sampling from the original every time the image needs repainting. This includes scrolling, resizing the window (in the case of % widths/heights), swishing another window over top of the image, etc.

> I suspect it requires DirectX etc. and is probably more trouble than it's worth OpenGL would be the route Mozilla would take if we had a volunteer. OpenGL has the advantage of being crossplatform. Bug 170553 <>

Don't get me wrong, I would enjoy bicubic interpolation in certain cases (especially the 2048x4096 scaled down to 1024x2048), but those cases are few and far inbetween. Sites that take large images and WIDTH=50 them deserve to have their images look ugly as a thumbnail. Those sites end up being down after a month anyway, due to bandwidth limits.

Of course, lack of support for pretty resizing support and/or caching scaled images should not stop a developer from writing such a thing. One could write it and hook it to a *cough*yetanotherpref*cough*, which would be disabled by default.