//docs/MPImage.doc/SaveMPImageA


   NAME   
  SaveMPImageA -- Save an image in various formats. (V3)
  SaveMPIMage -- Varargs version of SaveMPImageA (V3)

   SYNOPSIS
  succ = SaveMPImageA( file,red,green,blue,width,height,taglist)
  D0                   A0   A1  A2    A3   D0    D1     A5

  BOOL SaveMPImageA( UBYTE *,UBYTE *,UBYTE *,UBYTE *,
                                   UWORD,UWORD,struct TagItem *);

  succ = SaveMPImage( file,red,green,blue,width,height,Tag1, ...)

  BOOL SaveMPImage( UBYTE *,UBYTE *,UBYTE *,UBYTE *,
                                   UWORD,UWORD,ULONG,...);

   FUNCTION
  Saves/displays an image held in chunky buffers.

   INPUTS
  file    - filename to save file as. If NULL or "" then image is
            displayed on a custom screen, or returned in BitMap (V7.0)
  red     - red chunky input.
  green   - green chunky input.
  blue    - blue chunky input.
  width   - width of chunky buffers
  height  - height of chunky buffers.
  taglist - pointer to TagItem array.

  Tags are:

  MPIS_MODE   - Data is ULONG CAMG of output IFF file/screen EHB and HAM
                will be added if required. If not supplied then
                MPIS_MODENAME will be used. If that is not supplied then
                a CAMG mode will be generated.
  MPIS_MODENAME - Data is char * mode name of CAMG of output. Invalid
                  names are ignored.
  MPIS_FORMAT - Data is char * specifying output format.
                Default is MPI_BW16. Values are:
                MPI_BW16   - "BW16"   - 16 colour ILBM grey scale.
                MPI_BW256  - "BW256"  - 256 colour ILBM grey scale.
                MPI_HAM6   - "HAM6"   - HAM6 with fixed (internal) palette.
                MPI_HAM6P  - "HAM6P"  - HAM6 with generated or supplied
                                        palette - see MPIS_PALETTE.
                MPI_HAM8   - "HAM8"   - HAM8 with fixed (internal) palette.
                MPI_HAM8P  - "HAM8P"  - HAM8 with generated or supplied
                                        palette - see MPIS_PALETTE.
                MPI_ILBM24 - "ILBM24" - 24 bit ILBM.
                MPI_PPM    - "PPM"    - P6 (or P5 if red,green and blue are
                                        the same).
                MPI_COLOUR - "COLOUR" - ILBM with generated or supplied
                                        palette - see MPIS_PALETTE.
                MPI_EHB    - "EHB"    - EHB with generated or supplied
                                        palette - see MPIS_PALETTE.
                MPI_JPEG   - "JPEG"   - JPEG see NOTES.
                MPI_PNM    - "PNG"    - PNG see NOTES.
                MPI_DCTV3  - "DCTV3"  - DCTV 3 bit plane format
                MPI_DCTV4  - "DCTV4"  - DCTV 4 bit plane format
  MPIS_PALETTE - Data is char * name of ILBM to load palette from.
  MPIS_COLOURS - Data is ULONG number of colours for MPI_COLOUR.
                 Default is is number of colours in MPIS_PALETTE if
                 supplied, otherwise 16. If greater than that from
                 MPIS_PALETTE then ignored.
  MPIS_12BIT   - Data is BOOL. If TRUE then use faster 12bit colour palette
                 generating algorithm for MPI_COLOUR and MPI_EHB. Default
                 is FALSE to use 18bit algorithm.
  MPIS_LINEAR  - Data is BOOL. If TRUE then for BW16/BW256 use linear
                 (not colour based) mapping. (V5.0)
  MPIS_GREYMAP - Data is UBYTE *. For BW16/BW256 palette map. Must point
                 to at least 16 of value 0 to 15 for BW16, 256 bytes of
                 0 to 255 for BW255. (V5.0)
                 Format is e.g. 0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1
                   Colour 0 will be black
                   Colour 1 will be white
                   etc.
                 This is the opposite to which you may expect!
  MPIS_OLDPALETTE - Palette to use (for HAMxP/COLOUR/EHB) (V7.0)
                    Data is UBYTE *, red in [0] to [255],
                                     green in [256] to [511]
                                     blue in [512] to [767]
  MPIS_NEWPALETTE - Palette used (for HAMx/COLOUR/EHB) (V7.0)
                    Data is UBYTE * (see MPIS_OLDPALETTE).
  MPIS_BITMAP  - BitMap to update (for BWxx/HAMxx/COLOUR/EHB/DCTVx) (V7.0)
                 Data is struct BitMap *
                 Image is not displayed/saved

   RESULT
  error - 1 for success, 0 for failure.
          Use MPImageErrorMessage() to get error.

   EXAMPLE

   NOTES
  If MPIS_FORMAT is BW16 or BW256 and red,green and blue are the same then
  a more efficent algorithm is used.

  When displaying on screen click in the top left and press a key to exit.

  If file format is JPEG and env/mpimage/cjpeg is set (e.g. cjpeg "%s" "%s")
  then cjpeg is used.

  If file format is PNG and env/mpimage/pnmtopng is set
  (e.g. 'pnmtopng "%s" >"%s"') then pnmtopng is used.

   BUGS
  Does not work for images > 1024 wide (except PPM/JPEG/PNG).
  The palette file requires a body which is loaded and then discarded.

  Waits 20 seconds for cjpeg/pnmtopng to start then aborts. This check is
  not fool proof and the PIPE:xxx can be left hanging.

  Prior to version 4.3 fails to determine a screen mode correctly.

  V7.0 did not handle MPIS_BITMAP correctly.

  V7.3 did not set return code when MPIS_BITMAP supplied.

   SEE ALSO
  MPImageErrorMessage().