JPGTN

Section: Graphics Software (2)
Updated: June 14, 2002
Index Return to Main Contents

 

NAME

jpgtn - create thumbnails of JPEG files

 

SYNOPSIS

jpgtn [options] file(s)

 

OPTIONS

-d <directory>
Specifies a directory to put the output file(s) in. If this option is not supplied and the -S option is not in effect, it defaults to the current directory.
-f
Force overwrites of existing files when an output file already exists.
-h
Print a short usage message and exit.
-p <prefix>
Specify the filename prefix used for output files.
-q <quality>
Set JPEG quality setting for output file. The <quality> parameter is a number between 0 and 100. Effective range is probably only between 15 and 90.
-s <size>
The default behavior of this switch is to specify the size of the longest dimension of the output images in pixels. For instance, a size of 75 would create a thumbnail of the original image that would fit inside a 75 X 75 pixel box. The thumbnail's length/width ratio will be the same as the original image's. When used in conjunction with the -H switch or the -W switch, this option specifies the height or width of the final thumbnail. If this option is not supplied, or if it is not in the allowable range (2-2048) the size defaults to 128. The allowable range can be altered only prior to compiling.
-v
Increase the verbosity level. This switch may be used multiple times.
-H
Specify that the thumbnail height should be the size specified with the -s switch (see above.) In this case, the thumbnail width is calculated by jpgtn and may be greater or lesser than the size specified by the -s switch depending on the original image.
-S
Send output to STDOUT instead of file(s). If this option is supplied, the -p and -d options are ignored and jpgtn only processes the first file on the command line.
-W
Specify that the thumbnail width should be the size specified with the -s switch (see above.) In this case, the thumbnail height is calculated by jpgtn and may be greater or lesser than the size specified by the -s switch depending on the original image.
-V
Print the version and copyright banner and exit.

 

DESCRIPTION

Jpgtn creates small versions of pictures stored in JPEG format and outputs these thumbnails either to STDOUT (for use with pipes, file redirection, or CGI scripts) or to the original filename with an optional prefix. You may also specify a directory which you wish all the output files to be written to.

Jpgtn writes one output file for each JPEG image file specified on the command line. In order to be able to associate these output files with the input files that they are generated from, jpgtn names them based on the input filename. In order to avoid accidental overwriting of the input files, jpgtn allows you to specify a prefix to prepend to each input filename to construct the output filename. Jpgtn also allows you to specify a directory to write the output files to. If no directory and no prefix is specified, jpgtn writes the output files to the current directory using names constructed by prepending the default prefix "tn_" to the input filenames.

If no prefix is specified, but a directory is specified, jpgtn will write one file for each input file to the directory. The resultant files will have the same filenames as the original images they were generated from.

If no directory is specified, but a prefix is specified, then jpgtn writes its output files to the current directory and names its output files by prepending the supplied prefix to the filename of the original image.

If both a directory and a prefix are specified, them jpgtn writes its output files to the specified directory and prepends the supplied prefix to the original image's filename to construct the output file's name.

The -S option forces jpgtn to write its output to stdout. If this option is supplied, jpgtn ignores the -d and the -p options. This option is useful if you want to take advantage of output redirection or if you want to dynamically generate thumbnails for a CGI application.

The -s option gives you some control over the size of the thumbnails that are generated. If you do not supply this option, a default size of 128 pixels is assumed. The number of pixels in the longest dimension of a thumbnail generated by jpgtn will not exceed 'size' pixels. E.g. if you supply this option with a parameter of 100 while making a thumbnail of a 200x100 pixel image, the resulting image will be 100x50 pixels. If the original jpeg is 200x200 pixels, the thumbnail will be 100x100, and so on.

The -q option sets the JPEG quality level of the output JPEG file. This defaults to 70, and although values between 1 and 100 inclusive are allowed, I would suggest that 15 is probably as low as you can go without running into readability problems etc., and there isn't much point going above 90. Also, note that quality level 100 is not lossless, nor is the quality level a percentage. See the JPEG FAQ for further enlightenment.

 

EXAMPLES

To create thumbnails of all the '.jpg' files in the current directory and output them to the current directory with the default prefix "tn_" use:

$ jpgtn *.jpg

To do the same thing as above, but to put the thumbnails in './thumbs' use:

$ jpgtn -d "./thumbs/" -p "tn_" *.jpg

To create a thumbnail of the file image.jpg no larger than 75x75 pixels and pipe it through the (hypothetical) program "jpegprog" use:
  $ jpgtn -S -s 75 image.jpg | jpegprog

To create a thumbnail which has a width of 64 pixels and maintains the original's height/width ratio from a file called foo.jpg use:

$ jpgtn -W -s 64 foo.jpg

To create a thumbnail which has a height of 64 pixels and maintains the original's height/width ratio from a file called bar.jpg use:

$ jpgtn -H -s 64 bar.jpg

 

ACKNOWLEDGEMENTS

Thanks to the Independent JPEG Group for writing their useful and flexible JPEG software, without which this program could not use the JPEG/JFIF file format.

Thanks to Willie Daniel who created gtnpic which this program is derived from. Thanks to Russell Marks who created tnpic which was the foundation for gtnpic and therefore the foundation of jpgtn as well.

Thanks to Terry Mackintosh for suggesting that there should be a way to make jpgtn resize a specified dimension while allowing the other dimension to float.

 

BUGS

Probably has some... if you find one please inform me at the address below.  

AUTHOR

Jeremy Madea <jeremymadea@mindspring.com>  

SEE ALSO

xv (1), cjpeg (1), djpeg (1)


 

Index

NAME
SYNOPSIS
OPTIONS
DESCRIPTION
EXAMPLES
ACKNOWLEDGEMENTS
BUGS
AUTHOR
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 20:10:30 GMT, June 23, 2002