# GBM - Bitmap Formats

The following bitmap file formats are supported by GBM release 1.50 or higher:

Bitmap Format | Multipage | Colour Depth
1 bpp | 2,3 bpp | 4 bpp | 5,6,7 bpp | 8 bpp | 16 bpp | 24 bpp | 32 bpp | 48 bpp | 64 bpp
Bitmap (OS/2, Windows) | R | RW |  | RW |  | RW | R | RW | R |  |
CompuServe Graphics Interchange Format | R | RW | R(2,3) | RW | R(5,6,7) | RW |  |  |  |  |
ZSoft PC Paintbrush |  | RW |  | RW |  | RW |  | RW |  |  |
Tagged Image File Format | R | RW | R(2) | RW |  | RW | R | RW | RW | RW | RW
Truevision Targa/Vista |  |  |  |  |  | RW | RW | RW | RW |  |
Amiga IFF / ILBM |  | RW | R(2,3) | RW | R(5,6,7) | RW |  | RW |  |  |
YUV12C M-Motion Frame Buffer |  |  |  |  |  |  |  | RW |  |  |
Portable Anymap | R | RW |  |  |  | RW |  | RW |  | RW |
Portable Bit-map | R | RW |  |  |  |  |  |  |  |  |
Portable Greyscale-map | R |  |  |  |  | RW |  |  |  |  |
Portable Pixel-map | R |  |  |  |  |  |  | RW |  | RW |
Portable Network Graphics |  | RW | R(2) | RW |  | RW | R | RW | RW | RW | RW
IBM KIPS |  |  |  |  |  | RW |  |  |  |  |
IBM Image Access eXecutive |  |  |  |  |  | RW |  |  |  |  |
X Windows Bitmap |  | RW |  |  |  |  |  |  |  |  |
X Windows PixMap |  | RW | R(2,3) | RW | R(5,6,7) | RW | R | RW | R | R | R
Archimedes Sprite (RiscOS) | R | RW |  | RW |  | RW |  |  |  |  |
IBM Printer Page Segment |  | RW |  |  |  |  |  |  |  |  |
GEM Raster |  | RW | R(2,3) | RW | R(5,6,7) | RW |  | RW |  |  |
Portrait |  |  |  |  |  |  |  | RW |  |  |
JPEG Interchange File Format |  |  |  |  |  | RW |  | RW | R |  |

R: Can be read
W: Can be written

bpp: Colour depth in bits per pixel
1..8: Palettised bitmaps (8 can be also grayscale bitmaps)
16: Grayscale or color bitmaps with 1 or 3 color channels (16 bits)
24: True color bitmaps with 3 color channels, 8 bits per channel
32: True color bitmaps with 3 color channels and 1 alpha channel, 8 bits per channel. Sometimes this also refers to CMYK bitmaps which are nevertheless converted to RGB.
48: True color bitmaps with 3 color channels, 16 bits per channel
64: True color bitmaps with 3 color channels and 1 alpha channel, 16 bits per channel. Sometimes this also refers to CMYK bitmaps which are nevertheless converted to RGB.
Note:
For backward compatibility reasons colour depths above 24 bpp have to be requested explicitly by using option ext_bpp. Otherwise the bitmap is read but provided downscaled to 24 bpp. For details see the chapters of the supporting file formats below.

## Format details, options for reading/writing

Normally, applications using GBM deduce the file format from the file extension. eg: `filename.gif` is a Compu$erve GIF file.

When specifying file names to programs written using GBM, it is usually possible to append a comma seperated list of format specific options. eg: you can say `webpiccy.gif,ilace`. In this case, the `ilace` is a cue to the code in GBM which writes GIF files, to tell it to write an interlaced GIF.

    Short name : Long name : File extensions

      Comments

    Bitmap : OS/2 1.1, 1.2, 2.0 / Windows 3.x, NT, 2000, XP bitmap : .BMP .VGA .BGA .RLE .DIB .RL4 .RL8
      Reads any of the above if uncompressed, run-length compressed (RLE4, RLE8, RLE24)
      or Windows MultiMedia encoded (RGB and BITFIELDS: 16bpp, 32bpp).
      Will not read CCITT G3 MH Fax compressed files.
      If input is an OS/2 bitmaparray file then which bitmap can be specified.
        Input options: index=# (default: 0)
      Can be made to write OS/2 1.1 or Windows 3.0 / OS/2 2.0 bitmaps
        Output options: 1.1,win,2.0 (default: 2.0, note win=2.0)

      For 1bpp bitmaps the forground and the background colours can be inverted:

      Foreground and background colours in palette can be inverted on input.
        Input options: inv
      Foreground and background colours in palette can be inverted on output.
        Output options: inv
      Foreground and background colours in bits can be inverted on input.
        Input options: invb
      Foreground and background colours in bits can be inverted on output.
        Output options: invb
      The best option for writing 1bpp bitmaps is to write the darkest
      colour as the foreground. The resulting bitmap will have darkest
      colour as 1 bits, and lightest colour as 0 bits. When reloaded
      WPFolders and GBM will give a black 1's on white 0's picture.
        Output option: darkfg
      Also, there is an option for writing 1bpp bitmaps with the lightest
      colour as foreground. As WPFolder and GBM assume the foreground is
      black and the background is white on reloading, this will typically
      cause the image to be inverted.
        Output option: lightfg

    GIF : CompuServe Graphics Interchange Format : .GIF
      Reads 1, bit data files.
      Reads 2, 3 and 4 bit data files and presents them as 4 bit.
      Reads 5, 6, 7 and 8 bit data files and presents them as 8 bit.
      Writes 1, 4 and 8 bit data files.
      Reads "GIF87a" and "GIF89a" style files.
      Writes "GIF87a" style files.
      Will write "GIF89a" file, if the transcol= option is used.
      Should correctly handle deferred clear-code in LZW data stream.
      Will not generate output with deferred clear-code.
      ie: should not break older GIF readers.
      Can specify index of image within file on read.
        Input option: index=# (default 0)
      Can specify to return decoded data so far rather than error if corrupt.
        Input option: errok
      Can specify screen size to write in output screen descriptor.
        Output options: xscreen=#,yscreen=# (defaults: image size).
      Can specify background colour index to write in file BMHD header.
        Output option: background=# (default: 0)
      Can specify position information in output image descriptor.
        Output options: xpos=#,ypos=# (defaults: 0,0).
      Can specify transparent colour index (useful for HTML embedding).
        Output option: transcol=# (default is none).
      Can specify transparent colour index same as first pixel.
        Output option: transcol=edge
      Can write interlaced GIFs (good for HTML <IMG=SRC="x.gif">)
        Output option: ilace
      Extensively test on GIF files from a wide variety of sources.
      Compatibility tested with xloadimage and xv.

    PCX : ZSoft PC Paintbrush Image format : .PCX .PCC
      Reads and writes 1,4,8 and 24 bit colour files.
      Subset of plane/bits-per-plane combinations supported.
      Files are read and written using a run-length coding scheme.
      Tested using Zsoft originated .PCX files.
      Compressed runs of pixels are not supposed to straddle scan lines.
      GBM never does this, but some other applications violate this rule.
      By default, if GBM finds that a run of pixels is longer than the scan
      line, it will use the leftover pixels on the next scan line.
      Some images will not load properly, as they require the loading
      program to discard those pixels in the run that extend beyond the end
      of the scan line. This behaviour can be enabled in GBM.
        Input option: trunc

    TIFF : Microsoft/Aldus Tagged Image File Format support : .TIF .TIFF

    Standard formats (backward compatible):
      Reads  1 bpp black/white and colour palette/gray level files.
      Reads  2 bpp colour palette/gray level files and presents them as  4 bpp.
      Reads  4 bpp colour palette/gray level files and presents them as  4 bpp.
      Reads  8 bpp colour palette/gray level files and presents them as  8 bpp.
      Reads 16 bpp colour palette/gray level files and presents them as 24 bpp.
      Reads 24 bpp colour files and presents them as 24 bpp.
      Reads 32 bpp colour files (RGB + alpha channel) and presents them as 24 bpp.
      Reads 48 bpp colour files and presents them as 24 bpp.
      Reads 64 bpp colour files (RGB + alpha channel) and presents them as 24 bpp.
      Reads CMYK ( 8 bit per channel) files and presents them as 24 bpp RGB (strip encoded only).
      Reads CMYK (16 bit per channel) files and presents them as 24 bpp RGB (strip encoded only).

    Extended formats (not backward compatible, import option ext_bpp required):
      Reads 16 bpp colour palette/gray level files and presents them as 48 bpp (strip encoded only).
      Reads 32 bpp colour files (RGB + alpha channel) and presents them as 32 bpp.
      Reads 48 bpp colour files and presents them as 48 bpp (strip encoded only).
      Reads 64 bpp colour files (RGB + alpha channel) and presents them as 64 bpp (strip encoded only).
      Reads CMYK (16 bit per channel) files and presents them as 48 bpp RGB (strip encoded only).

    Writes 1, 4, 8, 24, 32 (24 bpp + alpha), 48, 64 (48 bpp + alpha) bpp RGB files.

      The depth of the alpha channel must in all cases match with the depth of all RGB channels.

      Supports the following compression schemes:
      - uncompressed
      - LZW
      - PackBits
      - ThunderScan
      - NeXT
      - JPEG
      - CCITT
      - Deflate
      - Adobe Deflate

      Input:

      Handling of alpha channel:
        If the bitmap contains an associated alpha channel (pre-multiplied alpha), the alpha
        channel values are not separately returned. In this case a provided background color
        is ignored.
        If the bitmap contains an unaccociated alpha channel (not pre-multiplied alpha), the
        alpha channel is returned separately unless the client requests that it has to be
        calculated against the provided background color.
        In the case the ext_bpp option is not specified and the bitmap contains an unassociated
        alpha channel, the alpha channel is only calculated against the background color if
        a background color has been specified by the client. Otherwise the alpha channel data
        is ignored.

      Can specify image within TIFF file with many images
        Input option: index=# (default: 0)
      Can specify background color as RGB for alpha channel mixing
      (only interpreted for bitmaps with unassociated alpha channel)
        Input option: back_rgb=#_#_# (red_green_blue, 0..65535)
      Can specify that non-standard GBM color depths are exported (also with alpha channel)
        Input option: ext_bpp (default: bpp is downsampled to 24 bpp)

      Output:

      Handling of alpha channel:
        GBM allows writing of unassociated alpha channel information for 32 and 64 bpp.
        It can also associate separately provided alpha channel information by
        pre-multiplying a specified background color against the RGB channels (option back_rgb).
        If the alpha channel has already been associated (pre-multiplied), color depths
        of 24 and 48 bpp should be used when writing RGB bitmaps.

      Can specify background color as RGB for associating alpha channel
      (the alpha channel is preserved in the bitmap file)
        Output option: back_rgb=#_#_# (red_green_blue, 0..65535)
      Can write 1bpp as non-Baseline file preserving fg/bg cols
      (this can be done to enforce writing a B/W palette bitmap,
       usually non B/W bitmap is automatically detected and a palette image is written)
        Output option: pal1bpp
      Can ask for specific strip size
        Output option: strip_size=# (4,8,16,32,64 kBytes, default=16)
      Can ask for LZW compression.
        Output option: lzw
      Can ask for LZW compression with horizontal prediction
        Output option: lzw_pred_hor
      Can ask for PackBits compression.
        Output option: packbits
      Can ask for Deflate compression (Adobe compatible Deflate).
        Output option: deflate
      Can specify Deflate compression level
        Output option: deflate_comp=# (default=6, 1..9, no compression to max)
      Can ask for JPEG compression (only 24 bpp).
        Output option: jpeg
      Can specify JPEG quality level
        Output option: jpeg_quality=# (default=75, 0..100)
      Can ask for CCITT modified Huffman RLE encoding (only 1 bpp).
        Output option: ccittrle
      Can ask for CCITT Group 3 fax encoding (only 1 bpp).
        Output option: ccittfax3
      Can ask for CCITT Group 4 fax encoding (only 1 bpp).
        Output option: ccittfax4
      Can specify informational tags to append on output.
        Output options: artist=,software=,make=,model=,host=,documentname=,pagename=,imagedescription=

    Targa : Truevision Targa/Vista bitmap : .TGA .VST .AFI
    Reads any uncompressed/run-length-compressed files.
    Writes out uncompressed files.

    Standard formats (backward compatible):
      Reads  8 bpp colour palette/greyscale files and presents them as 8 bpp.
      Reads 16 bpp RGB files and presents them as 24 bpp.
      Reads 24 bpp colour files and presents them as 24 bpp.
      Reads 32 bpp colour files (RGB + alpha channel) and presents them as 24 bpp.

    Extended formats (not backward compatible, import option ext_bpp required):
      Reads 32 bpp colour files (RGB + alpha channel) and presents them as 32 bpp.

    Input:

      This code will read files with both top-left-origin and bottom-left-origin.
      Not all Targa readers correctly handle bottom-left-origin files.
      Horizontally flipped Targas will be read as well.
      When reading 16 bpp files (which are 5 red + 5 green + 5 blue + 1 alpha),
      they are loaded and presented as 24 bpp bitmaps with only the top 5 bits of
      each of the 8 bit bytes valid. The bottom 3 bits are zero.
      When reading 32 bpp files (which are 8 red + 8 green + 8 blue + 8 alpha),
      the alpha channel is ignored or provided when option ext_bpp was specified.

      Can specify that non-standard GBM color depths are exported (also with alpha channel)
        Input option: ext_bpp (default: bpp is downsampled to 24 bpp)

    Output:

      8 bit data is always written out as a colour mapped file.

      Can request writing as 16 bpp data. If the data is 24 bpp, then the 16 flag causes
      only the most significant 5 bits of the red, green and blue to be written in a 16
      bit pixel. An existing alpha channel is ignored.
      This option is only valid for 24 and 32 bpp data.
        Output options: 16

      Can request writing as 24 bpp data. An existing alpha channel is ignored.
      This option is only valid for 24 and 32 bpp data.
        Output options: 24 (default when source data is 24 bit)

      Can request writing as 32 bpp data. If the data is 24 bpp, then the 32 flag causes
      the data to be padded with 8 zero bits of alpha channel to make a 32 bit pixel.
      If there is a real alpha channel provided (32 bpp data), its data is used.
      This option is only valid for 24 and 32 bpp data.
        Output options: 32 (default when source data is 32 bit)

      Write image data flipped vertically. This does not have a visual effect but
      is rather an internal data format option. This might help to increase compatibility
      to other programs.
        Output options: ydown,yup (default: yup)

    ILBM : Amiga IFF / ILBM Interleaved bitmap format : .IFF .LBM
      Reads 1 bit palettised files.
      Reads 2,3 and 4 bit palettised files, returning them as 4 bit.
      Reads 5,6,7 and 8 bit palettised files, returning them as 8 bit.
      Reads 24 bit images and returns them as 24 bit.
      Reads HAM6, HAM8, SHAM and Extra-Halfbrite images.
      HAM6, HAM8 and SHAM returned as 24 bit data.
      Writes 1,4 and 8 bit palettised colour files.
      Writes 24 bit files normally, or by converting to HAM6 first.
      This loses quality but results are still better than 8 bit.
      Understands the RLE compression scheme used.
      Uses BMHD, CMAP, CAMG and BODY sections of file only.
      Only writes BMHD, CMAP, CAMG and BODY sections in output files.
      Can specify position information in file BHMD header.
        Output options: xpos=#,ypos=# (defaults: 0,0).
      Can specify transparent colour to write in file BMHD header.
        Output option: transcol=# (default: 0)
      Can specify aspect ratio to write in file BMHD header.
        Output options: xaspect=#,yaspect=# (defaults: 1,1).
      Can specify screen size to write in output BMHD header.
        Output options: xscreen=#,yscreen=# (defaults: image size).
      Can specify to write 24 bpp data in HAM6 format.
        Output option: ham6
      Note that when DeluxePaint etc. try to load an 8 bit IFF file, they
      switch to a 32 colour (5 bit mode) and only read the 5 least
      significant planes of the file - this generally looks yukky!
      Tested using DeluxePaint sample bitmaps.

    YUV12C : YUV12C M-Motion Frame Buffer : .VID
      Reads files and presents data as 24 bit data.
      Writes 24 bit data files by converting them into 12 bit YUV.
      VID files MUST be a multiple of 4 pixels wide.
      When writing a non-multiple of 4, the last 1, 2 or 3 pixels are lost.
      Can specify image origin information in YUV12C header.
        Output options: xpos=#,ypos=# (defaults: 0,0).
      Tested using M-Control Program 2.0, Browser sample application.

    Anymap : Portable Anymap : .PNM

    Standard formats (backward compatible):
      Reads  1 bpp black/white images     (ASCII format P1, binary format P4).
      Reads  8 bpp grey images            (ASCII format P2, binary format P5).
      Reads 24 bpp unpalettised RGB files (ASCII format P3, binary format P6).
      Reads 48 bpp unpalettised RGB files and presents them as 24 bpp (ASCII format P3, binary format P6).

    Extended formats (not backward compatible, import option ext_bpp required):
      Reads 48 bpp unpalettised RGB files and presents them as 48 bpp (ASCII format P3, binary format P6).

    Writes 1 bpp black/white images (ASCII format P1, binary format P4).
    Writes grey equivalent of passed in 8 bit colour data (no palette written) (ASCII format P2, binary format P5).
    Writes 24 and 48 bpp unpalettised RGB files (ASCII format P3, binary format P6).

      Input:

      Invert the data bits on input (1 bpp only)
        Input option: invb
      Can specify image within PNM file with multiple images (only for binary type)
        Input option: index=# (default: 0)
      Can specify that non-standard GBM color depth is exported (48 bpp)
        Input option: ext_bpp (default: bpp is downsampled to 24 bpp)

      Output:

      Invert the data bits on output (1 bpp only)
        Output option: invb
      Can specify the colour channel the output grey values are based on (8bpp only)
        Output option: r,g,b,k (default: k, combine color channels and write grey equivalent)
      Write ASCII format (default is binary)
        Output option: ascii
      Write additonal comment
        Output option: comment=TEXT

    Bit-map : Portable Bit-map : .PBM
      No palette present in file format.
      Reads  1 bpp black/white images (ASCII format P1, binary format P4).
      Writes 1 bpp black/white images (ASCII format P1, binary format P4).

      Input:

      Can specify image within PBM file with multiple images (only for P4 type)
        Input option: index=# (default: 0)
      Invert the data bits on input
        Input option: invb

      Output:

      Invert the data bits on output
        Output option: invb
      Write ASCII format P1 (default is binary P4)
        Output option: ascii
      Write additonal comment
        Output option: comment=TEXT

    Greymap : Portable Greyscale-map : .PGM
      No palette present in file format.
      Reads  8 bpp grey images (ASCII format P2, binary format P5).
      Writes 8 bpp grey equivalent of passed in 8 bit colour data (no palette written)
             (ASCII format P1, binary format P4)

      Input:

      Can specify image within PGM file with multiple images (only for P5 type)
        Input option: index=# (default: 0)

      Output:

      Can specify the colour channel the output grey values are based on
        Output option: r,g,b,k (default: k, combine color channels and write grey equivalent)
      Write ASCII format P2 (default is binary P5)
        Output option: ascii
      Write additonal comment
        Output option: comment=TEXT

    Pixmap : Portable Pixel-map : .PPM

    Standard formats (backward compatible):
      Reads 24 bpp unpalettised RGB files (ASCII format P3, binary format P6).
      Reads 48 bpp unpalettised RGB files and presents them as 24 bpp (ASCII format P3, binary format P6).

    Extended formats (not backward compatible, import option ext_bpp required):
      Reads 48 bpp unpalettised RGB files and presents them as 48 bpp (ASCII format P3, binary format P6).

    Writes 24 and 48 bpp unpalettised RGB files (ASCII format P3, binary format P6).

      Input:

      Can specify image within PPM file with multiple images (only for binary type P6)
        Input option: index=# (default: 0)
      Can specify that non-standard GBM color depth is exported (48 bpp)
        Input option: ext_bpp (default: bpp is downsampled to 24 bpp)

      Output:

      Write ASCII format P3 (default is binary P6)
        Output option: ascii
      Write additonal comment
        Output option: comment=TEXT

    PNG : Portable Network Graphics Format : .PNG

    Standard formats (backward compatible):
      Reads  1 bpp black/white and colour palette/gray level files.
      Reads  2 bpp colour palette/gray level files and presents them as  4 bpp.
      Reads  4 bpp colour palette/gray level files and presents them as  4 bpp.
      Reads  8 bpp colour palette/gray level files and presents them as  8 bpp.
      Reads 16 bpp gray level files and presents them as 24 bpp.
      Reads 32 bpp gray level files (16 bit gray + alpha channel) and presents them as 24 bpp.
      Reads 24 bpp colour files and presents them as 24 bpp.
      Reads 32 bpp colour files (RGB + alpha channel) and presents them as 24 bpp.
      Reads 48 bpp colour files and presents them as 24 bpp.
      Reads 64 bpp colour files (RGB + alpha channel) and presents them as 24 bpp.

    Extended formats (not backward compatible, import option ext_bpp required):
      Reads 16 bpp gray level files and presents them as 48 bpp.
      Reads 32 bpp gray level files (16 bit gray + alpha channel) and presents them as 64 bpp.
      Reads 32 bpp colour files (RGB + alpha channel) and presents them as 32 bpp.
      Reads 48 bpp colour files and presents them as 48 bpp.
      Reads 64 bpp colour files (RGB + alpha channel) and presents them as 64 bpp.

    Writes 1, 4, 8, 24, 32 (24 bpp + alpha), 48, 64 (48 bpp + alpha) bpp RGB files.

      The depth of the alpha channel must in all cases match with the depth of all RGB channels.

      Input:

      Handling of alpha channel:
        PNG alpha channel is always unassociated (not pre-multiplied alpha).
        The alpha channel is returned separately unless the client requests that it has
        to be calculated against the provided background color.
        In the case the ext_bpp option is not specified and the bitmap contains an alpha
        channel, the alpha channel is only calculated against the background color if a
        background color has been specified by the client or is provided by the bitmap.
        Otherwise the alpha channel data is ignored.

      Can specify screen gamma
        Input option: gamma=# (default=2.2)
      Can specify a default background color as RGB to be used for all image types
      (if the bitmap has a background associated, it is replaced by the specified color)
        Input option: back_rgb=#_#_# (red_green_blue, 0..65535)
      Can ignore a bitmap provided background
      (helpful if the alpha channel should be preserved and the bitmap rendered by the
       application against a textured background)
        Input option: ignore_back
      Can specify that non-standard GBM color depths are exported (also with alpha channel)
        Input option: ext_bpp (default: bpp is downsampled to 24 bpp)

      Output:

      Handling of alpha channel:
        GBM allows writing of unassociated alpha channel information for 32 and 64 bpp.
        If the alpha channel has already been associated (pre-multiplied), color depths
        of 24 and 48 bpp should be used when writing RGB bitmaps.
        If a full alpha channel is provided, transparency cannot be specified additionally.

      Can write interlaced PNGs (good for HTML)
        Output option: ilace
      Can write user defined image gamma
        Output option: gamma=#
      Can specify background colour index for palette/gray images to write in file PNG header.
      (alpha channel is preserved in the bitmap file)
        Output option: back_index=#
      Can specify background colour as RGB for RGB images to write in file PNG header.
      (alpha channel is preserved in the bitmap file)
        Output option: back_rgb=#_#_# (red_green_blue, 24/32 bpp: 0..255, 48/64 bpp: 0..65535)
      Can specify transparency for palette images to write in file PNG header.
      (only for bitmap without alpha channel)
        Output option: transparency=#  (0..255, opaque..transparent)
      Can specify transparency colour for RGB images to write in file PNG header.
      (only for bitmap without alpha channel)
        Output option: transcol_rgb=#_#_# (red_green_blue, 24/32 bpp: 0..255, 48/64 bpp: 0..65535)
      Can specify compression level
        Output option: compression=# (default=6, 0..9, no compression to max)

    KIPS : IBM KIPS : .KPS
      Reads 8 bit palettised files.
      Will look for palette in .PAL file unless .KPL file specified.
        Input options: pal,kpl (default: pal)
      Writes 8 bit palettised files.
      Will write palette in .PAL file unless .KPL file specified.
        Output options: pal,kpl (default: pal)

    IAX : IBM Image Access eXecutive : .IAX
      Reads array as 8 bit greyscale.
      File format does not hold image dimensions.
      Hence code assumes width is 512 pixels unless overridden.
        Input options: width=# (default: 512)
      File format does not include palette.
      Writes red, green, blue plane or greyscale equivelent of 8 bit image.
        Output options: r,g,b,k (default: k)

    XBitmap : X Windows bitmap : .XBM
      Reads 1bpp X bitmaps, presenting 1's as black, 0's as white.
      Writes 1bpp X bitmaps, darkest colours as 1's, brightest colour as 0's.
      Tested upon some sample .XBM files.

    XPixMap : X Windows PixMap : .XPM
      X PixMap files are ASCII text files, that look to be directly source
      include-able in C programs (XPM1, XPM2C, XPM3). There exists also a simple
      XPM2 subformat that is a simplified version without any C cource code
      elements. Only the formats XPM2 and XPM3 without extensions are supported by GBM.
      XPM3 data is not syntactically checked when reading, so there might be files that
      cannot be read.

      Standard formats (backward compatible):
        Reads RGB files with hex or X11 symbolic coded colours (4,8,12,16 bit per R,G or B).
        Depending on the number of colours the bitmap is presented as either 1,4,8 or 24 bpp.
        Transparency is supported.

      Extended formats (not backward compatible, import option ext_bpp required):
        Reads RGB files with hex or X11 symbolic coded colours (4,8,12,16 bit per R,G or B).
        Depending on the number of colours the bitmap is presented as either 1,4,8,24,32,48 or 64 bpp.
        Transparency is supported.

      Writes RGB files with 1,4,8 or 24 bpp.

      Input:

      Can specify background color as RGB when alpha channel is provided
      (replacement color for transparency)
        Input option: back_rgb=#_#_# (red_green_blue, 0..65535)

      Can specify that non-standard GBM color depths are exported (also with alpha channel)
        Input option: ext_bpp (default: bpp is downsampled to 24 bpp)

      Output:

      Write XPM2 format (default is XPM3)
        Output option: xpm2

      Can specify transparent colour index (only for palette bitmaps).
        Output option: transcol=# (default is none)

      Can specify transparency colour (only for bitmap without alpha channel)
        Output option: transcol_rgb=#_#_# (red_green_blue, 24 bpp: 0..255)

    Sprite : Archimedes Sprite format from RiscOS : .SPR .SPRITE
      Technically sprite files have no extension.
      But GBM recognises .SPR and .SPRITE for convenience.
      Reads 1,4 and 8 bit sprites.
      'First bit' value in header must be a multiple of 8 (v.likely).
      Will only read image plane, will ignore any mask plane.
      Will handle case when no palette present in file.
      Will default to the default Wimp palette in this case.
      If input contains more than one sprite then which can be specified.
        Input options: index=# (default: 0)
      Will output 1,4 and 8 bit files.
      Will write a palette in the file.
      Will only write an image plane, ie: no mask plane.
      Will write a 16 entry palette for 8 bit data (not 64 entry).
      Will map to wierd archmedes palette when writing 8 bit data.
      Tested reading 4bpp sprites with no palette.
      Tested reading 8bpp sprites with no palette and with 64 entry palette.
      Sprites generated by GBM have been loaded on RiscOS.
      Remember: Use SetType to change type of file from PC-file to Sprite,
      by SetType option of filer menu or "*SetType <filename> Sprite".

    PSEG : IBM Printer Page Segment : .PSE .PSEG .PSEG38PP .PSEG3820
      This is a file format used by IBM document/printing systems.
      It is used to represent a bi-level image to be used in a document.
      Reads data and presents a 1bpp bitmap.
      Image is presented 1's as black on 0's as white background.
      PSEG files should be downloaded from a VM host in binary mode.
      Some PSEG files have a corrupt record structure.
      This doesn't cause a problem on VM but can confuse a non-VM reader.
      GBM can be made to attempt to handle these files.
        Input option: fixrec
      Will output 1bpp file.
      Will output file with scale factor of 1000
      Can specify new scale for both x and y
        Output options: scalex=#, scaley=#
      Can double the scale factors (option exists for backwards compatibility).
        Output option: double
      WIll output file with pel values of 2400 (dots per 10 inches, ie: 240 dpi).
      Can specify new pel values for both x and y
        Output options: pelx=#, pely=#
      Palette in 1bpp data is lost when written to file.
      The resulting non-VM file has no record structure.
      So when it is uploaded it must be fixed using FIXL3820 EXEC or similar.
      Image width is rounded up to next multiple of 8 when written.

    GemRas : GEM Raster : .IMG .XIMG
      There is a basic level of support, and assorted XIMG extensions.
      One extension is the inclusion of palette info.
      Another allows 24 bpp data to be placed into an .IMG file.
      Reads 1 bpp files (which are B/W) and returns 1 bpp data.
      Reads 2,3 and 4 bpp files (col, grey, XIMG with pal) and returns 4 bpp.
      Reads 5,6,7 and 8 bpp files (grey, XIMG with pal) and returns 8 bpp.
      Reads 24 bpp (which are by definition XIMG) files and returns 24 bpp.
      Writes 1 bpp data as B/W 1 bpp file.
      Writes 4 bpp data mapped to 'standard' 16 colour palette.
      Or writes 4 bpp data greyscale 4 bpp file.
        Output option: grey
      Or writes 4 bpp data to XIMG file with palette.
        Output option: pal
      There is no 'standard' palette for 256 colour files.
      Writes 8 bpp data as greyscale 8 bpp file.
      Or writes 8 bpp to XIMG file with palette.
        Output option: pal
      Writes 24 bpp data as an XIMG file (normal file can't do 24 bpp).
      The pixel dimensions in microns can be specified.
        Output options: pixw=#,pixh=# (defaults: 85,85)

    Portrait : Portrait : .CVP
      In Germany, photographers sometimes supply a floppy with a .CVP on it.
      File holds a single 512x512 24bpp RGB image.
      File is uncompressed, and will therefore always be 3/4Mb.
      You can only write 512x512 images using this format.
      Pixels in the file are not square, the width is approx. 3/4 the height.
      This aspect ratio problem is not adjusted for when reading or writing.

    JPEG : JPEG File Interchange Format : .JPG .JPEG .JPE
      Reads JPEG-FIF images with 8 Bit per component (YUV, YCCK, CMYK)
      Also reads progressive JPEG images
      Also reads greyscale JPEG images (Y only)
      Writes JPEG-FIF images with 8 Bit per component (YUV)

      Can specify to write a simple progressive JPEG, default is not to
        Output Option: prog (write a simple progressive JPEG, default is not to)

      Can specify the compression quality
        Output Option: quality=# (0 to 100, default 75)

      Can specify the smoothing factor
        Output Option: smooth=# (0 to 100, default 0 - no smoothing)

      Can specify to write an optimized JPEG
        Output Option: optimize (write optimized JPEG, default is not to)

      Can specify the colour channel the output grey values are based on
        Output option: r,g,b,k (default: k, combine color channels and write grey equivalent)

      Write additonal comment
        Output option: comment=text