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

FreeBSD Manual Pages


home | help
JPGTN(2)		       Graphics	Software		      JPGTN(2)

       jpgtn - create thumbnails of JPEG files

       jpgtn [options] file(s)

       -d <directory>
	      Specifies	 a directory to	put the	output file(s) in. If this op-
	      tion is not supplied and the -S option is	not in effect, it  de-
	      faults to	the current directory.

       -f     Force  overwrites	 of existing files when	an output file already

       -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>  parame-
	      ter  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 in-
	      stance, 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	thumb-
	      nail.   If  this	option is not supplied,	or if it is not	in the
	      allowable	range (1-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

       -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

       -S     Send output to STDOUT instead of file(s).	If this	option is sup-
	      plied,  the  -p  and  -d options are ignored and jpgtn only pro-
	      cesses 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

       -V     Print the	version	and copyright banner and exit.

       Jpgtn creates small versions of pictures	stored in JPEG format and out-
       puts  these thumbnails either to	STDOUT (for use	with pipes, file redi-
       rection,	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 cur-
       rent 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

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

       The -S option forces jpgtn to write its output to stdout. If  this  op-
       tion  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 al-
       lowed, 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 go-
       ing above 90. Also, note	that quality level 100 is not lossless,	nor is
       the quality level a percentage. See the JPEG FAQ	for further enlighten-

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

       $ jpgtn *.jpg

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

       $ 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

       Thanks to the Independent JPEG Group for	writing	their useful and flex-
       ible  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  de-
       rived  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	dimen-
       sion to float.

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

       Jeremy Madea <>

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

Version	2.01			 June 14, 2002			      JPGTN(2)


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

home | help