I made a quick example to demonstrate the power of the JPGSizeExtractor class i wrote about a year ago. This is a demo that came up from a brief mail exchange with Richard Bacon who was looking at the class.
The example loads 10 images (one at a time), parses their
SOF0 headers to get
the dimensions, stops the load and draws grey boxes as backgrounds, setting the
layout. This way building the layout is very quick and you don’t have to wait
for the whole images to load. It’s kind of the same idea as specifying the
width and height for images in html to maintain the layout even before the
image has loaded.
When all sizes have been parsed the images themselves are loaded. For the demo the images are scaled down to 25% to make them fit better in the small window here. The total filesize for all 10 images is 4169kb. All images are from sxc.hu.
Please keep in mind that this example is of the type “quick and dirty”, and is only meant as a proof of concept. The code for the example was written just to make it work, not to make it pretty or flexible.
The source is available in a zip.