A map file may have zero, one or more OUTPUTFORMAT object declarations, defining available output formats supported including formats like PNG, GIF, JPEG, GeoTIFF and Flash (SWF).
If OUTPUTFORMAT sections declarations are not found in the map file, the following implicit declarations will be made. Only those for which support is compiled in will actually be available. The GeoTIFF depends on building with GDAL support, and the Flash (SWF) depends on compiling with support for the MING library.
OUTPUTFORMAT
NAME aggpng24
DRIVER AGG/PNG
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
OUTPUTFORMAT
NAME gif
DRIVER "GD/GIF"
MIMETYPE "image/gif"
IMAGEMODE PC256
EXTENSION "gif"
END
OUTPUTFORMAT
NAME png
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE PC256
EXTENSION "png"
END
OUTPUTFORMAT
NAME jpeg
DRIVER "GD/JPEG"
MIMETYPE "image/jpeg"
IMAGEMODE RGB
EXTENSION "jpg"
END
OUTPUTFORMAT
NAME wbmp
DRIVER "GD/WBMP"
MIMETYPE "image/wbmp"
IMAGEMODE PC256
EXTENSION "wbmp"
END
OUTPUTFORMAT
NAME swf
DRIVER "SWF"
MIMETYPE "application/x-shockwave-flash"
EXTENSION "swf"
IMAGEMODE PC256
FORMATOPTION "OUTPUT_MOVIE=SINGLE"
END
OUTPUTFORMAT
NAME GTiff
DRIVER "GDAL/GTiff"
MIMETYPE "image/tiff"
IMAGEMODE RGB
EXTENSION "tif"
END
Selects the imaging mode in which the output is generated. Does matter for non-raster formats like Flash. Not all formats support all combinations. For instance GD/GIF supports only PC256. (optional)
Provides a driver or format specific option. Zero or more FORMATOPTION statement may be present within a OUTPUTFORMAT declaration. (optional)
GD/JPEG: The “QUALITY=n” option may be used to set the quality of jpeg produced (value from 0-100).
GD/PNG: The “INTERLACE=[ON/OFF]” option may be used to turn interlacing on or off.
GD/GIF: The “INTERLACE=[ON/OFF]” option may be used to turn interlacing on or off.
GDAL/GTiff: Supports the TILED=YES, BLOCKXSIZE=n, BLOCKYSIZE=n, INTERLEAVE=[PIXEL/BAND] and COMPRESS=[NONE,PACKBITS,JPEG,LZW,DEFLATE] format specific options.
GDAL/*: All FORMATOPTIONs are passed onto the GDAL create function. Options supported by GDAL are described in the detailed documentation for each GDAL format
GD/PNG and AGG/PNG both support quantizing from 24/32 bits to 8bits, in order to reduce the final image size (and therefore save bandwidth) (see also http://trac.osgeo.org/mapserver/ticket/2436#comment:4 for strategies when applying these options):
- “QUANTIZE_FORCE=on” used to reduce an RGB or RGBA image into an 8bit (or less) paletted images. The colors used in the palette are selected to best fit the actual colors in the RGB image (RGBA quantization was introduced in mapserver 5.2, and requires the –enable-experimental-png flag to be used when configuring)
- “QUANTIZE_COLORS=256” used to specify the number of colors to be used when applying quantization. Maximum value is 256. Specifying anything between 17 and 255 is probably a waste of quality as each pixel is still encoded with a full byte. Specifying a value under 16 will produce tiny images, but severly degraded.
- “QUANTIZE_NEW=on” used to force using a slower but higher quality quantization algorithm for RGB images. The default behavior is to use a fast but crude quantization algorithm, that usually results in duplicate entries in the palette, and visible artifacts when tiling.
- “PALETTE_FORCE=on” is used to reduce image depth with a predefined palette. This option is incompatible with the previous quantization options.
- “PALETTE=/path/to/palette.txt” is used to define the absolute path where palette colors can be found. This file must contain 256 entries of r,g,b triplets for RGB imagemodes, or r,g,b,a quadruplets for RGBA imagemodes. The expected format is one triplet (or quadruplet) per line, each value separated by commas, and each triplet/quadruplet on a single line. If less than 256 triplets are found in the file, 256-n remaining colors will be computed by quantization.