IMGSIZER(1)
π imgsizer(1) β the Web Tools girlie that fixes your IMG tags π
okay so bestie. imagine you're out here writing HTML like it's 2003 and every single <IMG> tag is missing its HEIGHT and WIDTH. tragic. imgsizer is the Web Tools utility that rolls up, reads your HTML, and automatically splices in the height and width params for your IMG tags. she's giving main character energy and she absolutely ate. periodt. π
β¨ NAME β¨
imgsizer β automatically splice in height and width params for HTML IMG tags. no cap, that's literally her whole job. π
πΈ SYNOPSIS πΈ
imgsizer [-d file] [--document-root file] [-h file] [--help file] [-n]
[--no-overwrite] [HTMLFile] [-v file] [--version]
π¦ OPTIONS π¦
-V,--versionβ shows you the version info and then dips. bye! π-h,--helpβ prints the usage info so you know what's up.-d <directory>,--document-root <directory>β the directory where images with an absolute filename (iykyk, the ones with a leading/) can be found. ποΈ-n,--no-overwriteβ do not overwrite existing width and height tags if both of them are already there. she's respectful like that. π
π DESCRIPTION π
so the imgsizer script automates away the most tedious task in the entire universe: creating and updating the HEIGHT and WIDTH parameters in HTML IMG tags. why do we even care? because those parameters help a ton of browsers (the whole Netscape/Mozilla family included, bestie) multi-thread image loading β instead of having to load images in strict sequence just so each one's dimensions are known before the next one can be placed. the glow-up here is that text on the rest of the page loads much faster. speed. β¨
this script will try to create those attributes for any IMG tag that's missing them. and she'll correct existing HEIGHT and WIDTH tags too β unless either one contains a percent (%) sign, in which case the existing dimensions are presumed to be relative and get left unaltered. she knows when to mind her business. π
you can call this script with no arguments at all. in that mode, she filters HTML on stdin β HTML on stdout (unaltered except for the added or corrected HEIGHT and WIDTH attributes). if you call her with file arguments, she'll attempt to transform each file in place. and here's the cute part: each argument file isn't actually modified until the script completes a successful conversion pass. safe. π₯
the -d <directory> option sets the DocumentRoot, where images with an absolute filename (i.e., ones which contain a leading /) may be found. if you don't specify one, the DocumentRoot defaults to the current working directory. π«Ά
the -n (no-overwrite) option prevents the program from overwriting existing width and height tags if both are present.
extra options can also be specified in the environmental variable IMGSIZER. for example, to avoid typing imgsizer -d /var/www/docs every single time imgsizer is invoked, you might tell sh (or one of its descendants):
IMGSIZER="-d /var/www/docs"; export IMGSIZER
or, if you use csh:
setenv IMGSIZER "-d /var/www/docs"
this script is written in Python, so she requires a Python interpreter on the host system. she also requires either the identify(1) utility distributed in the open-source ImageMagick suite of image-display and manipulation tools, or a modern version of file(1) and rdjpgcom(1). those utilities are what extract sizes from the images β imgsizer herself has no knowledge of graphics formats, she's just vibes and regex. the script will handle any image format known to identify(1), including PNG, GIF, JPEG, XBM, XPM, PostScript, BMP, TIFF, and anything else even remotely likely to show up as an inline image. literally all of them. π
β NOTE β
not me bringing up the old era but β the -q, -l, and -m options of the 1.0 versions are gone. what they used to do has been made unnecessary by smarter logic. she evolved. π
π BUGS π
the code uses regular expressions rather than true HTML/XML parsing. so some perverse but legal constructions β like extraneous space within quoted numeric attributes β will be mangled. π regex girlies, we knew the risk.
π AUTHOR π
Originally created by Eric S. Raymond <esr@thyrsus.com>. Additional code contributed by Erik Rossen, Michael C. Toren <michael@toren.net>, and others. For updates, see <http://www.catb.org/~esr
π SEE ALSO π
identify(1), file(1), rdjpgcom(1).
and that's the whole page bestie!! imgsizer, from the Web Tools collection, page dated 01/21/2026 β she's timestamped and iconic and you're welcome. go fix those IMG tags, you absolute legend. π«Άπβ¨
π¦ where this page comes from
- ubuntu resolute: imgsizer 2.12-1build1 Β· BSD-2-Clause
- ubuntu stonking: imgsizer 2.12-1build1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms