Thursday, April 05
Don't browsers do at least bilinear scaling these days? It can't be that CPU intensive.
Update: Turns out, it is pretty CPU intensive.
Resizing a 750x1200 image to 500x800 to suit my blog takes 2ms using nearest-neighbour scaling (which is what browsers use), 49ms using bilinear filtering, and 117ms using bicubic filtering.
The time is proportional to the number of pixels in the target image; starting with a 1500x2400 image took only 1 or 2% longer.
So not great for automated image sizing - not without a healthy cache, anyway - but pretty good for generating thumbnails on the fly. A 150x240 thumbnail takes 4.5ms to generate; at 200x320, about 8ms.
One thing I will likely use this for is avatars. I don't want to enforce a fixed size for avatars across mu.nu/mee.nu, because the idea has always been that it's your [blog|forum|wiki|whatever] and you control the way it looks. But having avatars of all different sizes looks like crap, and having a range of sizes (which is what I was considering) is fiddly.
But if I make it so that you upload one image at say 240x240, and that automatically gets resized according to the template tag, that could work well. Some timings on that: 50x50 0.3ms; 60x60 0.4ms; 75x75 0.7ms; 100x100 1.2ms. It takes a minimum of 3-5ms to serve a file in the first place, so that's not a huge imposition on the server.
[comment.avatar size=60] here we come!
Posted by: Wonderduck at Friday, April 06 2007 04:15 AM (svIB9)
Posted by: skeptica at Friday, April 06 2007 09:26 PM (z6gAP)
Posted by: Pixy Misa at Friday, April 06 2007 10:13 PM (PiXy!)
Posted by: Pixy Misa at Friday, April 06 2007 10:19 PM (PiXy!)
52 queries taking 0.1638 seconds, 285 records returned.
Powered by Minx 1.1.6c-pink.