|
Ever put together a Web page with lots of images but get a little lazy about adding size tags? This leads to wacky layout jittering when a page is loading. I wrote this very simple program - HTML Image Sizer - to fetch an HTML page and automatically add size tags to all <img> tags, fetching the images as necessary to determine their sizes. It will work on local files or on http-based Web pages. The output is written to a local file. If the program sees that an image already has width and height tags, it won’t touch them. It’s really lame about how it checks this, though: if you use css to specify image sizes, this program won’t notice. If the program sees that one of the dimensions has been specified, it will scale the other dimension accordingly (with the same caveat about not looking at CSS). It has no concept of %-based image sizes. To run it, download it, unzip it, cd into the directory where you put it, and run: ImageSizer.exe [html source] [output file name] The zipfile also includes the source to the program. It’s a Windows program written in C#; it requires the .net 2.0 framework. Download the program and source: Happy sizing. Feel free to mail dmorris@cs.stanford.edu with comments. |