![]() |
PictoolsCommands |
by Zweibieren
|
|
This page details the commands and scripts noted in the overview. Along the way we will encounter these types of files, as denoted by their extensions. .html - A web page. .hin - This is the pictools extension for HTML source files. They must be processed through genhtml to create the .html file. .tpl - this file is in .html format, but will serve as a template to be expanded. Templates are inputs to genhtml, gensite, and gendirs. .jpg .gif .png .bmp - image files. Photographs are usually .jpg files because consideable file compression is possible in that file format. However, this format discards some of the original detail. The capitalized names are okay, too: .JPG .GIF .PNG .BMP. "thumbs" - a thumb, or thumbnail, image is just a smaller version of a larger image. Typically one page will show thumbs for many images and clicking a thumb will show a larger version of the same image. .cap - A captions file, with multiple segments. See next section. .deps .hdeps - MakeTargets generates these dependency files. They are included by MakeTargets itself to ensure that rebuilds happen when antecedent files change. .deps is for pictures from a DIGESTDIR; .hdeps is the dependencies of .html files generated from .hin files. |
||
Captions files - xxx.capA captions file, xxx.cap, is references to pictures, grouped in segments. Each segment generates a webpage of thumbnail images. A segment begins with a header line:file: segmentname title of segmentEach line after a segment header corresponds to one image file. The format of a line is [imagefilename] caption-textExample captions.cap file (for physpics.com/annals/Korea2006/pix/):
file:
apartment.txt Our
apartment and its view[100_2194.JPG] Kitchen as seen through living room.[100_2207.JPG] June 23, View from our balcony. Hazy as
usual.[100_3097.JPG] July 11, Our balcony on a rare sunny morning.The default name for a captions file is captions.cap. Any Makefile using MakeTargets has the target newpix. It creates file newpix.cap, but only if there is not already such a file. It is best to remove the contents of newpix.cap and insert them as an additional segment in captions.cap. |
Tool: genhtmlGenhtml is a macro expander for generating web pages with build time macro expansion. Macros begin with a dollar-sign; non-macro dollar-signs must be written as two dollar-signs: $$.Invocation genhtml [options] [-o outfile] [infile]Command line options
Macros There are three basic forms of macro. Variants are described in the table in the next section.
In parenthesized strings—$sym=(xxx) or $sym(xxx)—a backslash protects the next following character if it is one of )
] ' " % \\n
==> newline\r ==> carriage return\t ==> tabWithin parameters, whitespace characters are ignored immediately after the leading '('. Otherwise, whitespace is unchanged except newlines become spaces. A warning is printed for the first newline in a parameter because it may signal a missing ')'. Newlines can be hard to avoid with some html editors; one way to avoid them is the judicious insertion in the HTML source of comments containing newlines: <!-- The following macro calls may appear:
$pictures(f) $pictures generates a <table> of thumbnail pictures each linked to a larger version. f is the name of a .cap file. If (f) is omitted, the name is taken from the -c option. If that, too, has been omited, the default is "captions.cap." A .cap file has segments of multiple lines where the first line is file: segmentname Segment description text The lines within a segment each refer to a picture: [imagename.ext] caption From this list of pictures, $pictures creates a <table> of cells. Each cell is for one picture. There are ncell cells per row. (Default 3.) Each cell is an expansion of a pictd.tpl file. This file may be named by setting the pictd variable with -D on the command line: -Dpictd=filename.tpl Otherwise the used is the first found among ./pictd.tpl, $PICTOOLS/pictd.tpl, and an internal dummy value. For expanding pictd, the following variables are defined $piccaption the caption from the line in the .cap file $picalt the caption with <...> removed $picimage name of image (html encoded, but no extension) $picext extension on image name (not usually used) $picdir directory of pictures, relative to output file $picthumbsdir directory for thumbs, relative to output file $picthumbsize dimensions of the thumb file (see below) Picdir and picthumbsdir are relative to the server directory having the page itself. Their default values are . and ./thumbs. For finding sizes, genhtml needs to know at build time where the thumbnail pictures are relative to the directory where genhtml is being run. That value can be given with -Dpicthumbshome=dir. Otherwise the default is ./thumbs because gendirs runs genhtml in the staging directory where both the pictures and the generated .html file reside. There is no other dependency from genhtml on the pictures or thumbs. They do not necessarily exist. If the thumb exists as $picthumbshome/imagename.jpg and has width ww and height hhh, then $picthumbsize has the value width='www' height='hhh' otherwise it is the empty string. Link kludges Mozilla composer has some funny notions about changing link and image locations. To compensate, genhtml has funny notions of its own. It inserts .. before the slash in any of href="/, href='/, src="/, or src='/. And it deletes all but the last slash of file:///. So these strings cannot appear in a file. The workaround is to define a variable to have a single slash as its value: $slash=(/) Then $slash; replaces every terminal slash: file://$slash; |
|||||||||||||||||||||||||||||||||||||||||||||||||
Tool: gencapsGencaps finds all the image files (.jpg, .gif, .png) in a directory and creates a captions file listing them, though with blank captions.Invocation
gencaps
[-d picturesdir]
[-p prefix]
[outputfilename|-]Picturesdir is the directory to search for picture files. Default: ./. With -p prefix, image file names must start with the prefix. The ordering of lines in the output file is found by sorting the names numerically with the prefix removed. Thus for "-p Slide" files named Slide9.JPG, Slide10.JPG, and Slide11.JPG, will be listed in that order. By convention, outputfilename has extension .cap. The default is captions.cap. If outputfilename is a single dash, output is to stdout. The generated file has one line per image. It lists the image file name in square brackets followed by a space: [imagename.ext]
<one
space> |
Tool: genotherWhen editing captions files, it is common to reorder them and delete some. The deleted entries will be in the installed directory, but orphaned, without a link to them. Genother finds all images that are not mentioned in .cap files and writes (to stdout) a new captions text that just lists those orphans.Invocation genother
[-k] [[-d] picturesdir]Each output line is of form [imagefilename.ext] imagefilename |
Tool: splittxt
Splittxt reads a segmented captions file and
produces one captions
file for each segment. Segments
start with a line |
Tool: gensiteGensite processes a segmented .cap file and produces an HTML file for each segment. The HTML file begins as a template and is expanded by genhtml to have a section derived from the segment's captions. Typically, in a template for gensite, a click on a thumb image will bring up the full image in a separate window; that window is reused for viewing all full-sized images. See, for example, my Semester at Sea pictures.Invocation gensite
[-n ncols]
[-w wrapperfile] captions.capThe captions.cap file is divided into its segments and for each is created a captions file: segmentname.cap. (Any pre-existing segmentname.cap file is erased, and the new one is also erased after being used.) Then the html file is generated by calling genhtml
[-n ncols]
-c
segmentname.cap -o segmentname.html \
-t "title words
..."
-D... wrappernameThe -D... is a set of variable definitions:
For each segment gensite writes to stdout the html to refer to the new segmentname.html: <li><a
href="segmentname.html">title words...</a></li> |
Tool: gendirsGendirs is similar to gensite, but creates a new subdirectory for each segment of the captions file. The subdirectory has a separate HTML file for each photo. When viewing at the full-size, the pages cycle through these individual pages. There are not two windows as for gensite. One example is my pictures of Korea.Invocation gendirs
[-n ncols]
[-w indextemplate]
[-v picfiletemplate] [-x
piccelltemplate] captions.capThe captions.cap file has segment header lines of the form file: segmentname title-words ...
For each segment, directory ./segmentname/
is created and populated with an index.html file and one file for each
picture. The index.html is generated with this genhtml command:genhtml
-n ncols
-c localsegmentname.cap
-f segmentname
\ -t "title-words
..." -o segmentname/index.html
indextemplateAt the same time, gendirs writes to stdout the html to refer to the generated segmentname/index.html file: <li><a href="segmentname/index.html">title words ...</a></li> While expanding indextemplate the following variables have these values
The lines in segment localsegmentname.cap each have the form [imagename.ext] caption words ...
For each such line, an html file is generated in subdirectory segmentname/. This
file is
generated from picfiletemplate and
piccelltemplate with
this genhtml call:genhtml
-t "caption words ..."
-D... \ -o segmentname/imagename.html picfiletemplate
|
Tools: nobg,
nosur
Nobg and nosur are
the halo
removal
tools. They process
images to remove monochrome backgrounds. |
| -f fuzz-percent | Percentage fuzz around transparency color. All pixels having colors within this percent of the transparency color are also made transparent. Default: 5 |
| -b blur-spread | A parameter to the ImageMagick blur operator. This operation blurs the edge of the non-transparent areas so they partially transparent. Form: RxS, where R is the blur radius and S the standard deviation. Either value may be a decimal value like 0.5. R can be made high without too much blurring of the image edges. S over 3 will blur image edges. For examples see the section on the Blur-Spread. Default: 10x2 |
| -t | By default, images are trimmed to remove invisible outer rows or columns. The -t switch omits this step; so the image will remain its original size. |
| Copyright 2008, Zweibieren |
8 Aug 2008 11:38 PM
|
Page
maintained
by
Zweibieren ![]() |