'\" t .\" Title: imgsizer .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 03/20/2019 .\" Manual: Web Tools .\" Source: imgsizer .\" Language: English .\" .TH "IMGSIZER" "1" "03/20/2019" "imgsizer" "Web Tools" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" imgsizer \- automatically splice in height and width params for HTML IMG tags .SH "SYNOPSIS" .HP \w'\fBimgsizer\fR\ 'u \fBimgsizer\fR [\fB\-d\fR\ \fIfile\fR] [\-\-document\-root\ \fIfile\fR] [\fB\-h\fR\ \fIfile\fR] [\-\-help\ \fIfile\fR] [\fB\-n\fR] [\fB\-\-no\-overwrite\fR] [\fIHTMLFile\fR] [\fB\-v\fR\ \fIfile\fR] [\-\-version] .SH "OPTIONS" .PP .HP \w'\ 'u \-V, \-\-version .RS 4 Display version information and exit\&. .RE .PP .HP \w'\ 'u \-h, \-\-help .RS 4 Display usage information\&. .RE .PP .HP \w'\ 'u \-d\ \fI,\fR \-\-document\-root\ \fI\fR .RS 4 Directory where absolute image filenames (i\&.e, ones which contain a leading "/") may be found\&. .RE .PP \fB\-n, \-\-no\-overwwrite\fR, \&.SH DESCRIPTION .RS 4 The \fBimgsizer\fR 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\*(Aqs dimensions available so the next can be placed\&. This generally allows text on the remainder of the page to load much faster\&. .RE .PP 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\&. .PP 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\&. .PP The \fB\-d\fR 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\&. .PP The \-n (no\-overwrite) opion prevents the program from overwriting existing width and height tags if both are present\&. .PP Additional options may also be specified in the environmental variable "IMGSIZER"\&. For example, to avoid typing "imgsizer \fB\-d\fR /var/www/docs" each time \fBimgsizer\fR is invoked, you might tell sh (or one of its descendants): .sp .if n \{\ .RS 4 .\} .nf IMGSIZER="\-d /var/www/docs"; export IMGSIZER .fi .if n \{\ .RE .\} .PP or, if you use csh: .sp .if n \{\ .RS 4 .\} .nf setenv IMGSIZER "\-d /var/www/docs" .fi .if n \{\ .RE .\} .PP This script is written in Python, and thus requires a Python interpreter on the host system\&. It also requires either the \fBidentify\fR(1) utility distributed in the open\-source ImageMagick suite of image\-display and manipulation tools, or a modern version of \fBfile\fR(1) and \fBrdjpgcom\fR(1)\&. These utilities are used to extract sizes from the images; \fBimgsizer\fR itself has no knowledge of graphics formats\&. The script will handle any image format known to \fBidentify\fR(1) including PNG, GIF, JPEG, XBM, XPM, PostScript, BMP, TIFF, and anything else even remotely likely to show up as an inline image\&. .SH "NOTE" .PP 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\&. .SH "BUGS" .PP 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\&. .SH "AUTHOR" .PP Originally created by Eric S\&. Raymond \&. Additional code contributed by Erik Rossen, Michael C\&. Toren , and others\&. For updates, see <\m[blue]\fBhttp://www\&.catb\&.org/~esr\fR\m[]> .SH "SEE ALSO" .PP \fBidentify\fR(1), \fBfile\fR(1), \fIrdjpgcom(1)\&.\fR