JPG(1)                                                     JPG(1)

     NAME
          jpg, gif, png, tif, ppm, bmp, v210, yuv, ico, tga, tojpg,
          togeordi, togif, toppm, topng, totif, toico - view and
          convert pictures

     SYNOPSIS
          jpg [ -39cdefFkJrtvy ] [ file ... ]
          gif [ -39cdektv ] [ file ... ]
          png [ -39cdektv ] [ file ... ]
          tif [ -39cdektv ] [ file ... ]
          ppm [ -39cdektv ] [ file ... ]
          bmp [ -39cdektv ] [ file ... ]
          v210 [ -39cdektv ] [ file ... ]
          tga [ -39cdektv ] [ file ... ]
          yuv [ -39cdektv ] [ file ... ]

          tojpg [ -c comment ] [ -ks ] [ file ]
          togeordi [ -c comment ] [ -k ] [ file ]
          togif [ -c comment ] [ -l loopcount ] [ -d msec ] [ -t
          transindex ] [ file ... [ -d msec ] file ... | -E ]
          toppm [ -c comment ] [ -r ] [ file ]
          topng [ -c comment ] [ -g gamma ] [ file ]
          totif [ -c comment ] [ -3bgGhklLptvyY ] [ file ]

          ico [ -c ] [ file ]
          toico [ file ... ]

     DESCRIPTION
          These programs read, display, and write image files in pub-
          lic formats.  Jpg, gif, png, tif, ppm, bmp, tga, v210, and
          yuv read files in the corresponding formats and, by default,
          display them in the current window; options cause them
          instead to convert the images to Plan 9 image format and
          write them to standard output.  Tojpg, togif, toppm, topng,
          and totif read Plan 9 images files, convert them to JPEG,
          GIF, PPM, PNG, or TIFF and write them to standard output.

          The default behavior of jpg, gif, png, tif, ppm, bmp, tga,
          v210, and yuv is to display the file, or standard input if
          no file is named.  Once a file is displayed, typing a char-
          acter causes the program to display the next image.  Typing
          a q, DEL, or control-D exits the program.  For a more user-
          friendly interface, use page(1), which invokes these pro-
          grams to convert the images to standard format, displays
          them, and offers scrolling, panning, and menu-driven naviga-
          tion among the files.

          These programs share many options:

          -e   Disable Floyd-Steinberg error diffusion, which is used

     Page 1                       Plan 9            (printed 11/21/24)

     JPG(1)                                                     JPG(1)

               to improve the appearance of images on color-mapped
               displays, typically with 8 bits per pixel.  Primarily
               useful for debugging; if the display has true RGB
               color, the image will be displayed in full glory.

          -k   Convert and display the image as a black and white
               (really grey-scale) image.

          -v   Convert the image to an RGBV color-mapped image, even
               if the display has true RGB color.

          -d   Suppress display of the image; this is set automati-
               cally by any of the following options:

          -c   Convert the image to a Plan 9 representation, as
               defined by image(6), and write it to standard output.

          -9   Like -c, but produce an uncompressed image.  This saves
               processing time, particularly when the output is being
               piped to another program such as page(1), since it
               avoids compression and decompression.

          -t   Convert the image, if it is in color, to a true color
               RGB image.

          -3   Like -t, but force the image to RGB even if it is orig-
               inally grey-scale.

          Jpg has two extra options used to process the output of the
          LML video card:

          -f   Merge two adjacent images, which represent the two
               fields of a video picture, into a single image.

          -F   The input is a motion JPEG file, with multiple images
               representing frames of the movie.  Sets -f.

          The tojpg, togif, toppm and topng programs go the other way:
          they convert from Plan 9 images to JPEG, GIF, PPM, PNG, and
          TIFF and have no display capability.  They all accept an
          option -c to set the comment field of the resulting file.
          The -r option makes toppm output raw PPM.  The default is to
          output plain PPM.  The -k option makes tojpg output grey-
          scale images, and the -s option makes it output scratched
          JPEG images.  Togeordi is an rc(1) script that invokes tojpg
          -s.  Totif accepts many options.  Choosing Huffman, T4, or
          T6 compression forces the image to GREY1.

          -3   Convert the image to a true color RGB image.

          -b   Convert the image to a GREY1 black and white image.

     Page 2                       Plan 9            (printed 11/21/24)

     JPG(1)                                                     JPG(1)

          -g   Use T4 one-dimensional compression.

          -G   Use T4 two-dimensional compression.

          -h   Use Huffman compression.

          -k   Convert the image to a GREY8 grey-scale image.

          -l   Use LZW compression.

          -L   Use LZW compression with horizontal differencing.  Some
               TIFF decoders may not support horizontal differencing
               applied to images of depths less than eight.

          -p   Use Packbits compression.

          -t   Use T6 compression.

          -v   Convert the image to an RGBV color-mapped image.

          -y   Convert the image to a GREY2 grey-scale image.  Totif
               will then convert it to GREY4 before encoding because
               TIFF does not support depths of two.

          -Y   Convert the image to a GREY4 grey-scale image.

          If there is only one input picture, togif converts the image
          to GIF format.  If there are many files, though, it will
          assemble them into an animated GIF file.  The options con-
          trol this process:

          -lloopcount
               By default, the animation will loop forever; loopcount
               specifies how many times to loop.  A value of zero
               means loop forever and a negative value means to stop
               after playing the sequence once.

          -dmsec
               By default, the images are displayed as fast as they
               can be rendered.  This option specifies the time, in
               milliseconds, to pause while displaying the next named
               file.

          -E   Specifying this option instead of a list of files will
               read the frames from a pipe on fd 0.  Each frame is
               terminated with EOF.  End of the animation is specified
               by an extra EOF.

          Gif translates files that contain a `transparency' index by
          attaching an alpha channel to the converted image.

          Ico displays or converts a Windows icon (.ico) file.  If no

     Page 3                       Plan 9            (printed 11/21/24)

     JPG(1)                                                     JPG(1)

          file is specified, ico reads from standard input.  Icon
          files contain sets of icons represented by an image and a
          mask. The -c option causes ico to convert the first icon in
          the set and write it to standard output in compressed Plan 9
          image format. Otherwise, the whole icon set is displayed.
          Clicking the right button pops up a menu that lets you write
          any icon's image as a Plan 9 image (widthxheight.image),
          write any icon's mask as a Plan 9 image (widthxheight.mask),
          or exit.  Selecting one of the write menu items yields a
          sight cursor.  Move the sight over the icon and right click
          again to write.

          Toico takes a list of Plan 9 image files (or standard input)
          and creates a single icon file.  The masks in the icon file
          will be the white space in the image.  The icon file is
          written to standard output.

     SOURCE
          /sys/src/cmd/jpg
          /rc/bin/togeordi

     SEE ALSO
          page(1), image(6).
          http://www.w3.org/Graphics/JPEG/jfif3.pdf
          http://www.w3.org/Graphics/JPEG/itu-t81.pdf
          http://en.wikibooks.org/wiki/JPEG_-_Idea_and_Practice
          http://en.wikipedia.org/wiki/JPEG
          http://www.w3.org/Graphics/GIF/spec-gif89a.txt
          http://www.w3.org/TR/2003/REC-PNG-20031110
          http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
          http://netpbm.sourceforge.net/doc/ppm.html
          http://en.wikipedia.org/wiki/Windows_bitmap
          http://en.wikipedia.org/wiki/Yuv

     BUGS
          Writing an animated GIF using togif is a clumsy undertaking.

     HISTORY
          Tojpg first appeared in 9front (May, 2013).  Tif and totif
          first appeared in 9front (July, 2013).

     Page 4                       Plan 9            (printed 11/21/24)