Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
IMGSIZER(1)			   Web Tools			   IMGSIZER(1)

       imgsizer	- automatically	splice in height and width params for HTML IMG

       imgsizer	[-d file] [--document-root file] [-h file] [--help file] [-n]
		[--no-overwrite] [HTMLFile] [-v	file] [--version]


	   Display version information and exit.

	   Display usage information.

	   Directory where absolute image filenames (i.e, ones which contain a
	   leading "/")	may be found.

       -n, --no-overwwrite, .SH	DESCRIPTION
	   The imgsizer	script automates away the tedious task of creating and
	   updating the	extension HEIGHT and WIDTH parameters in HTML IMG
	   tags. These parameters help many browsers (including	the
	   Netscape/Mozilla family) to multi-thread image loading, instead of
	   having to load images in strict sequence in order to	have each
	   one's dimensions available so the next can be placed. This
	   generally allows text on the	remainder of the page to load much

       This script will	try create such	attributes for any IMG tag that	lacks
       them. It	will correct existing HEIGHT and WIDTH tags unless either
       contains	a percent (%) sign, in which case the existing dimensions are
       presumed	to be relative and left	unaltered.

       This script may be called with no arguments. In this mode, it filters
       HTML presented on stdin to HTML (unaltered except for added or
       corrected HEIGHT	and WIDTH attributes) on stdout. If called with	file
       arguments, it will attempt to transform each file in place. Each
       argument	file is	not actually modified until the	script completes a
       successful conversion pass.

       The -d <directory> option sets the DocumentRoot,	where images with an
       absolute	filename (i.e.,	ones which contain a leading "/") may be
       found. If none is specified, the	DocumentRoot defaults to the current
       working directory.

       The -n (no-overwrite) opion prevents the	program	from overwriting
       existing	width and height tags if both are present.

       Additional options may also be specified	in the environmental variable
       "IMGSIZER". For example,	to avoid typing	"imgsizer -d /var/www/docs"
       each time imgsizer is invoked, you might	tell sh	(or one	of its

	   IMGSIZER="-d	/var/www/docs";	export IMGSIZER

       or, if you use csh:

	   setenv IMGSIZER "-d /var/www/docs"

       This script is written in Python, and thus requires a Python
       interpreter on the host system. It 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).	These utilities	are used to extract sizes from the
       images; imgsizer	itself has no knowledge	of graphics formats. 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.

       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.

       The code	uses regular expressions rather	than true HTML/XML parsing.
       Some perverse but legal constructions, like extraneous space within
       quoted numeric attributes, will be mangled.

       Originally created by Eric S. Raymond <>.	Additional
       code contributed	by Erik	Rossen,	Michael	C. Toren <>,
       and others. For updates,	see <>

       identify(1), file(1), rdjpgcom(1).

imgsizer			  04/05/2015			   IMGSIZER(1)


Want to link to this manual page? Use this URL:

home | help