home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !FALCON / !BONUS / GFX / JPEGV5A.ZIP / doc / cjpeg.1 next >
Text File  |  1995-03-01  |  11KB  |  257 lines

  1. CJPEG(1)                 USER COMMANDS                   CJPEG(1)
  2.  
  3.  
  4.  
  5. NAME
  6.      cjpeg - compress an image file to a JPEG file
  7.  
  8. SYNOPSIS
  9.      cjpeg [ _✓o_✓p_✓t_✓i_✓o_✓n_✓s ] [ _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e ]
  10.  
  11. DESCRIPTION
  12.      cjpeg compresses the named image file, or the standard input
  13.      if  no  file  is named, and produces a JPEG/JFIF file on the
  14.      standard output.  The currently supported input file formats
  15.      are:  PPM  (PBMPLUS  color  format), PGM (PBMPLUS gray-scale
  16.      format), BMP, GIF, Targa, and RLE (Utah Raster Toolkit  for-
  17.      mat).   (RLE  is supported only if the URT library is avail-
  18.      able.)
  19.  
  20. OPTIONS
  21.      All switch names may be abbreviated; for example, -grayscale
  22.      may  be  written -gray or -gr.  Most of the "basic" switches
  23.      can be abbreviated to as little as one  letter.   Upper  and
  24.      lower  case  are equivalent (thus -GIF is the same as -gif).
  25.      British spellings  are  also  accepted  (e.g.,  -greyscale),
  26.      though for brevity these are not mentioned below.
  27.  
  28.      The basic switches are:
  29.  
  30.      -quality _✓N
  31.           Scale quantization  tables  to  adjust  image  quality.
  32.           Quality  is  0  (worst)  to  100 (best); default is 75.
  33.           (See below for more info.)
  34.  
  35.      -grayscale
  36.           Create monochrome JPEG file from color input.  Be  sure
  37.           to  use  this  switch  when compressing a grayscale GIF
  38.           file, because  cjpeg  isn't  bright  enough  to  notice
  39.           whether a GIF file uses only shades of gray.  By saying
  40.           -grayscale, you'll get a smaller JPEG file  that  takes
  41.           less time to process.
  42.  
  43.      -optimize
  44.           Perform optimization of  entropy  encoding  parameters.
  45.           Without  this,  default  encoding  parameters are used.
  46.           -optimize usually makes the JPEG file a little smaller,
  47.           but  cjpeg  runs  somewhat  slower  and needs much more
  48.           memory.  Image quality and speed of  decompression  are
  49.           unaffected by -optimize.
  50.  
  51.      -targa
  52.           Input file is Targa format.  Targa files  that  contain
  53.           an  "identification"  field  will  not be automatically
  54.           recognized by cjpeg; for such files  you  must  specify
  55.           -targa  to  make cjpeg treat the input as Targa format.
  56.           For most Targa files, you won't need this switch.
  57.  
  58.      The -quality switch lets you trade off compressed file  size
  59.      against  quality  of the reconstructed image: the higher the
  60.      quality setting, the larger the JPEG file,  and  the  closer
  61.      the  output  image  will be to the original input.  Normally
  62.      you want to use the lowest quality setting  (smallest  file)
  63.      that  decompresses into something visually indistinguishable
  64.      from the original image.  For this purpose the quality  set-
  65.      ting should be between 50 and 95; the default of 75 is often
  66.      about right.  If you see defects at -quality 75, then go  up
  67.      5 or 10 counts at a time until you are happy with the output
  68.      image.  (The optimal setting will vary  from  one  image  to
  69.      another.)
  70.  
  71.      -quality 100 will generate a quantization table of all  1's,
  72.      eliminating  loss  in  the  quantization  step (but there is
  73.      still information loss in subsampling, as well  as  roundoff
  74.      error).  This setting is mainly of interest for experimental
  75.      purposes.  Quality values above about 95 are not recommended
  76.      for  normal  use;  the compressed file size goes up dramati-
  77.      cally for hardly any gain in output image quality.
  78.  
  79.      In the other direction, quality values below 50 will produce
  80.      very small files of low image quality.  Settings around 5 to
  81.      10 might be useful in preparing an index of  a  large  image
  82.      library, for example.  Try -quality 2 (or so) for some amus-
  83.      ing Cubist effects.  (Note: quality values  below  about  25
  84.      generate  2-byte  quantization  tables, which are considered
  85.      optional in the JPEG standard.  cjpeg emits a  warning  mes-
  86.      sage  when  you give such a quality value, because some com-
  87.      mercial JPEG programs may be unable to decode the  resulting
  88.      file.   Use -baseline if you need to ensure compatibility at
  89.      low quality values.)
  90.  
  91.      Switches for advanced users:
  92.  
  93.      -dct int
  94.           Use integer DCT method (default).
  95.  
  96.      -dct fast
  97.           Use fast integer DCT (less accurate).
  98.  
  99.      -dct float
  100.           Use  floating-point  DCT  method.   The  floating-point
  101.           method  is  the  most accurate, but will be the slowest
  102.           unless  your  machine  has  very  fast   floating-point
  103.           hardware.  Also note that results of the floating-point
  104.           method may vary slightly  across  machines,  while  the
  105.           integer  methods  should  give  the same results every-
  106.           where.  The fast integer method is much  less  accurate
  107.           than the other two.
  108.  
  109.      -restart _✓N
  110.           Emit a JPEG restart marker every N MCU rows, or every N
  111.           MCU  blocks if "B" is attached to the number.  -restart
  112.           0 (the default) means no restart markers.
  113.  
  114.      -smooth _✓N
  115.           Smooth the input image to  eliminate  dithering  noise.
  116.           N,  ranging  from  1  to 100, indicates the strength of
  117.           smoothing.  0 (the default) means no smoothing.
  118.  
  119.      -maxmemory _✓N
  120.           Set limit for amount of memory  to  use  in  processing
  121.           large  images.  Value is in thousands of bytes, or mil-
  122.           lions of bytes if "M" is attached to the  number.   For
  123.           example,  -max 4m selects 4000000 bytes.  If more space
  124.           is needed, temporary files will be used.
  125.  
  126.      -outfile _✓n_✓a_✓m_✓e
  127.           Send output image to the named file,  not  to  standard
  128.           output.
  129.  
  130.      -verbose
  131.           Enable debug printout.  More  -v's  give  more  output.
  132.           Also, version information is printed at startup.
  133.  
  134.      -debug
  135.           Same as -verbose.
  136.  
  137.      The -restart option inserts extra markers that allow a  JPEG
  138.      decoder   to   resynchronize  after  a  transmission  error.
  139.      Without restart markers, any damage  to  a  compressed  file
  140.      will  usually  ruin the image from the point of the error to
  141.      the end of the image; with restart markers,  the  damage  is
  142.      usually  confined to the portion of the image up to the next
  143.      restart marker.  Of course, the restart markers occupy extra
  144.      space.   We  recommend  -restart  1  for images that will be
  145.      transmitted across unreliable networks such as Usenet.
  146.  
  147.      The -smooth option filters the input to eliminate fine-scale
  148.      noise.   This  is  often useful when converting GIF files to
  149.      JPEG: a moderate smoothing factor of 10 to 50  gets  rid  of
  150.      dithering patterns in the input file, resulting in a smaller
  151.      JPEG file and a better-looking image.  Too large a smoothing
  152.      factor will visibly blur the image, however.
  153.  
  154.      Switches for wizards:
  155.  
  156.      -arithmetic
  157.           Use arithmetic coding rather than Huffman coding.  (Not
  158.           currently supported for legal reasons.)
  159.  
  160.      -baseline
  161.           Force a baseline  JPEG  file  to  be  generated.   This
  162.           clamps  quantization values to 8 bits even at low qual-
  163.           ity settings.
  164.  
  165.      -nointerleave
  166.           Generate noninterleaved JPEG file (not yet supported).
  167.  
  168.      -qtables _✓f_✓i_✓l_✓e
  169.           Use the quantization  tables  given  in  the  specified
  170.           file.   The  file should contain one to four tables (64
  171.           values each) as plain text.  Comments preceded  by  '#'
  172.           may be included in the file.  The tables are implicitly
  173.           numbered 0,1,etc.  If -quality _✓N is also specified, the
  174.           values  in  the  file  are  scaled according to cjpeg's
  175.           quality scaling curve.
  176.  
  177.      -qslots _✓N[,...]
  178.           Select which quantization table to use for  each  color
  179.           component.   By  default, table 0 is used for luminance
  180.           and table 1 for chrominance components.
  181.  
  182.      -sample _✓H_✓x_✓V[,...]
  183.           Set JPEG sampling factors.  If you  specify  fewer  H/V
  184.           pairs  than  there  are  components, the remaining com-
  185.           ponents are set to 1x1 sampling.  The  default  setting
  186.           is equivalent to -sample 2x2.
  187.  
  188.      The "wizard" switches are intended for experimentation  with
  189.      JPEG.  If you don't know what you are doing, don't use them.
  190.      You can easily produce files with worse image quality and/or
  191.      poorer  compression  than  you'll  get from the default set-
  192.      tings.  Furthermore, these switches should not be used  when
  193.      making  files intended for general use, because not all JPEG
  194.      implementations will support  unusual  JPEG  parameter  set-
  195.      tings.
  196.  
  197. EXAMPLES
  198.      This example compresses the PPM file foo.ppm with a  quality
  199.      factor of 60 and saves the output as foo.jpg:
  200.  
  201.           cjpeg -quality _✓6_✓0 _✓f_✓o_✓o._✓p_✓p_✓m > _✓f_✓o_✓o._✓j_✓p_✓g
  202.  
  203. HINTS
  204.      Color GIF files are not the ideal input for  JPEG;  JPEG  is
  205.      really  intended for compressing full-color (24-bit) images.
  206.      In particular, don't try to convert cartoons, line drawings,
  207.      and  other images that have only a few distinct colors.  GIF
  208.      works great on these, JPEG does not.  If you want to convert
  209.      a  GIF  to JPEG, you should experiment with cjpeg's -quality
  210.      and  -smooth  options  to  get  a  satisfactory  conversion.
  211.      -smooth 10 or so is often helpful.
  212.  
  213.      Avoid  running  an  image   through   a   series   of   JPEG
  214.      compression/decompression  cycles.   Image quality loss will
  215.      accumulate; after ten or so cycles the image may be  notice-
  216.      ably  worse than it was after one cycle.  It's best to use a
  217.      lossless format while manipulating an image, then convert to
  218.      JPEG format when you are ready to file the image away.
  219.  
  220.      The -optimize option to cjpeg is worth using  when  you  are
  221.      making  a  "final"  version  for posting or archiving.  It's
  222.      also a win when you are using low quality settings  to  make
  223.      very small JPEG files; the percentage improvement is often a
  224.      lot more than it is on larger files.
  225.  
  226. ENVIRONMENT
  227.      JPEGMEM
  228.           If this environment variable is set, its value  is  the
  229.           default  memory  limit.   The  value  is  specified  as
  230.           described for the -maxmemory switch.  JPEGMEM overrides
  231.           the  default  value specified when the program was com-
  232.           piled, and itself is overridden by  an  explicit  -max-
  233.           memory.
  234.  
  235. SEE ALSO
  236.      djpeg(1), rdjpgcom(1), wrjpgcom(1)
  237.      ppm(5), pgm(5)
  238.      Wallace, Gregory K.  "The  JPEG  Still  Picture  Compression
  239.      Standard",  Communications  of the ACM, April 1991 (vol. 34,
  240.      no. 4), pp. 30-44.
  241.  
  242. AUTHOR
  243.      Independent JPEG Group
  244.  
  245. BUGS
  246.      Arithmetic coding is not supported for legal reasons.
  247.  
  248.      Not all variants of BMP and  Targa  file  formats  are  sup-
  249.      ported.
  250.  
  251.      The -targa switch is not a bug, it's a feature.   (It  would
  252.      be  a  bug  if the Targa format designers had not been clue-
  253.      less.)
  254.  
  255.      Still not as fast as we'd like.
  256.  
  257.