


IMVFBTOINDEX8(3IM)     SDSC IMAGE LIBRARY      IMVFBTOINDEX8(3IM)



NAME
     ImVfbToIndex8 - Convert a virtual frame buffer to  an  8-bit
     index image
     ImVfbToIndex16 - Convert a virtual frame buffer to a  16-bit
     index image
     ImVfbToIndex - Convert a virtual frame buffer to a  _n  color
     index image
     ImVfbToRgb - Convert a virtual frame buffer to an RGB image
     ImVfbToGray - Convert a virtual frame buffer to a  grayscale
     image
     ImVfbToGrey - Convert a virtual frame buffer to a  grayscale
     image
     ImVfbToMono - Convert a virtual frame buffer to a monochrome
     image

SYNOPSIS
     #include "im.h"

     ImVfb *ImVfbToIndex8( srcVfb, dstVfb )
          ImVfb *srcVfb ;
          ImVfb *dstVfb ;

     ImVfb *ImVfbToIndex16( srcVfb, dstVfb )
          ImVfb *srcVfb ;
          ImVfb *dstVfb ;

     ImVfb *ImVfbToIndex( srcVfb, numColors, dstVfb )
          ImVfb *srcVfb ;
          int    numColors;
          ImVfb *dstVfb ;

     ImVfb *ImVfbToRgb( srcVfb, dstVfb )
          ImVfb *srcVfb ;
          ImVfb *dstVfb ;

     ImVfb *ImVfbToGray( srcVfb, dstVfb )
          ImVfb *srcVfb ;
          ImVfb *dstVfb ;

     ImVfb *ImVfbToGrey( srcVfb, dstVfb )
          ImVfb *srcVfb ;
          ImVfb *dstVfb ;

     ImVfb *ImVfbToMono( srcVfb, threshold, dstVfb )
          ImVfb *srcVfb ;
          int threshold ;
          ImVfb *dstVfb ;


DESCRIPTION
     Each of these routines convert an  image  stored  in  _s_r_c_V_f_b
     into an image of a different type and store it in _d_s_t_V_f_b.  A



SDSC              Last change: August 19, 1992                  1






IMVFBTOINDEX8(3IM)     SDSC IMAGE LIBRARY      IMVFBTOINDEX8(3IM)



     pointer to the converted destination Vfb is returned.

     ImVfbToIndex8 converts a virtual frame buffer  to  an  8-bit
     image.

     ImVfbToIndex16 converts a virtual frame buffer to  a  16-bit
     image.

     ImVfbToIndex converts a virtual frame buffer to a  numColors
     indexed image.

     ImVfbToRgb converts a virtual frame buffer to an RGB image.

     ImVfbToGray and ImVfbToGrey convert a virtual  frame  buffer
     to an 8-bit gray scale image.

     ImVfbToMono converts a virtual frame buffer to a  monochrome
     image.    Each   monochromatic   pixel   value,  queried  by
     ImVfbQMono (3IM), is 0 (white) or 1 (black).

NOTES
     The _s_r_c_V_f_b and _d_s_t_V_f_b may be the same Vfb without unpleasant
     side effects.

     When ImVfbToGray is called, the resulting gray scale  values
     are  placed in the IMVFBINDEX8 field of the destination vir-
     tual frame buffer.

     Conversion from grayscale to monochrome uses  the  _t_h_r_e_s_h_o_l_d
     value  as  the  breakpoint  between  white and black values.
     Grayscale pixels with values less  than  the  threshold  are
     converted  to  white;  those  equal  to  or greater than the
     threshold are converted to black.

     Conversion from color to grayscale computes the  gray  value
     for each pixel using the NTSC Y equation:

               Gray ~~=~~ 0.30*R ~+~ 0.59*G ~+~ 0.11*B

     Conversion from a color index image to an RGB image uses the
     _s_r_c_V_f_b's  color  lookup table to look up each pixel value to
     obtain its RGB color.  If the _s_r_c_V_f_b  has  no  color  lookup
     table, a grayscale ramp is used.

     Conversion from an RGB image to a color  index  image  scans
     the  RGB image to build a color lookup table.  ImVfbToIndex8
     builds a new 256-entry (or fewer) color lookup table,  while
     ImVfbToIndex16  builds a 65536-entry (or fewer) color lookup
     table.  If the RGB image uses more colors than may be stored
     in  such color tables, then color approximations are made to
     minimize color oddities.




2                 Last change: August 19, 1992               SDSC






IMVFBTOINDEX8(3IM)     SDSC IMAGE LIBRARY      IMVFBTOINDEX8(3IM)



     ImVfbToIndex  converts  any  VFB  to  an  indexed  VFB  with
     numColors  or  less.   This  has the affect of increasing or
     decreasing the number of colors in an indexed VFB.   If  the
     dstVfb  is  IMVFBNEW,  a new VFB will be created that is the
     smallest VFB that  can  hold  numColors.   New  dstVfb  with
     numColors  of  values  1 to 256 will have IMVFBINDEX8 VFB's.
     New dstVfb with numColors of values 256 to 65,536 will  have
     IMVFBINDEX16 VFB's.  Larger indexed VFB's are not supported.

RETURNS
     Upon success, all functions return a  pointer  to  the  con-
     verted  destination  Vfb.   An  error causes IMVFBNULL to be
     returned and the value of ImErrNo to be set to  one  of  the
     following:

          IMEMALLOC    Cannot allocate enough memory for the new Vfb
          IMENOTINFO   There is not enough information in _s_r_c_V_f_b
                       for the operation

SEE ALSO
     ImIntro (3IM), ImErrNo (3IM),  ImVfbAlloc  (3IM),  ImVfbCopy
     (3IM), ImVfbDup (3IM)

AUTHORS
     Mike Bailey, Dave Nadeau
     San Diego Supercomputer Center

CONTACT
     SDSC consultants, (619)534-5100, consult@y1.sdsc.edu


























SDSC              Last change: August 19, 1992                  3



