GBM - Introduction
Overview
The Generalised Bitmap Module (GBM) is a library capable of loading
and saving bitmap files in a variety of popular bitmap file formats
.
Programs may be written to use this code, and thus be able to access a variety
of file formats without actually knowing what format the pictures are in, or
any details about file format itself.
Additionally the GBM package contains of a number of other components:
- Some pieces of code that perform common operations on bitmap data such
as reflection, X-Y transposition, rotation, cropping, scaling, halftoning,
error-diffusing, palette mapping, and colour space mapping.
These operations are available as ready to use C libraries.
-
Some command line programs which use the above code.
-
OS/2 REXX libraries for loading and saving bitmap formats, scaling, reflecting,
rotating and colour conversions.
-
An OS/2 PM bitmap viewer and an editor supporting all the above functionality.
-
Plugins for the OS/2 Lucide Document Viewer and the OS/2 versions of the webbrowsers
Netscape, Mozilla, Firefox and SeaMonkey.
Platforms
GBM is available for several platforms, namely OS/2, Windows, Linux, DOS and AIX.
Note:
The version provided here is so far only supported on OS/2, Windows and Linux.
Though it shouldn't be a problem to compile it for other platforms as
it uses pure ANSI C code. You can get versions for other platforms
supporting a smaller feature set on the homepage of the initial author
Andy Key.
Enhancements
Many enhancements have been applied compared to the original version provided by Andy Key:
GBM format handler library
- PNG (new codec)
- based on latest Libpng
- supports all RGB/Gray color depths (1,2,4,8,16,24,32,48,64bpp)
- supports transparency and alpha channel
- supports PNG provided and custom backgrounds
- TIF (replacement codec)
- based on latest Libtiff
- supports multipage bitmaps
- supports most RGB/Gray color depths (1,2,4,8,16,24,32,48,64bpp), partly CMYK (8/16bpp)
- supports alpha channel (with rendering against a custom background)
- Compression schemes: LZW, PackBits, ThunderScan, NeXT, JPEG, CCITT, Deflate, Adobe Deflate
- PBM (new codec)
- reads and writes 1bpp black/white bitmaps
- supports format types P1 (ASCII) and P4 (binary)
- supports multipage P4 bitmaps
- PGM (enhanced codec)
- reads and writes 8bpp grey bitmaps
- supports format types P2 (ASCII) and P5 (binary)
- supports multipage P5 bitmaps
- PPM (replacement codec)
- reads and writes 24 and 48bpp RGB bitmaps
- supports format types P3 (ASCII) and P6 (binary)
- supports multipage P6 bitmaps
- PNM (new codec)
- PNM consolidates the formats PBM, PGM and PPM under one extension
- supports format types P1,P2,P3 (ASCII) and P4,P5,P6 (binary)
- supports multipage P4,P5 and P6 bitmaps
- BMP (enhanced codec)
- reads also RLE24 encoded OS/2 bitmaps
- reads also Windows MultiMedia bitmaps (RGB, BITFIELDS: 16bpp, 32bpp)
- handles now 1bpp color bitmaps rather than always mapping them to black/white
- JPEG (enhanced codec)
- updated to IJG JPEG 6B
- reads also YCCK and CMYK encoded JPEGs
- writes also grayscale JPEGs (8bpp)
- some new write options are available like smoothing and optimizing
- JPEG2000 (new codec)
- based on latest OpenJPEG library
- supports RGB/YUV/Gray color depths (8,16,24,48 bpp)
- writes images with lossless or lossy compression
- TGA (enhanced codec)
- reads also horizontally flipped TGAs
- reads TGAs with alpha channel (32 bpp)
- writes TGAs with alpha channel (32 bpp)
- XPM (new codec)
- reads and writes XPM2 and XPM3 formats without extensions (no XPM1, XPM2C)
- supports RGB files with hex or X11 symbolic coded colours (4,8,12,16 bit per R,G or B)
- supports transparency
- REXX adapter DLL available (GBMRX)
Command line tools
- gbmsize, gbmhdr, gbmref, gbmsub, gbmgamma
- now also support 32, 48 and 64bpp (with/without alpha channel)
- gbmsize now supports also resampled scaling with several filters (Nearest Neigbor, Bilinear, Bell, BSpline, Mitchell, Lanczos)
- gbmconv added (format converter)
- gbmver added (helps analyzing all installed GBM DLLs and provides version compatibility hints for users)
- Enhanced command line parser to fix some issues when filenames with comma where specified
JPEG support
The Independant JPEG Group have generously allowed others to use
their source code to their JPEG handling library. The only condition
of use is that the IJG must be credited for their work. Try looking
for this library at:
Martin Lisowski has generously donated his gbmjpg.c
to GBM. This file
allows GBM to use the IJG 6b library.
GBM may be compiled up either with or without JPEG support. If you
use the JPEG enabled variety of GBM in your project, you must credit
the IJG. This code has been tested on OS/2, AIX, Linux and Windows.
JPEG2000 support (extension to base version)
The Open Source library OpenJPEG 1.3 can be used to build GBM
with JPEG2000 support. Try looking for the library at:
I (Heiko Nitzsche) have donated gbmj2k.c
to GBM. This file
allows GBM to use the OpenJPEG 1.3 library.
GBM may be compiled up either with or without JPEG2000 support. If you use
the JPEG2000 enabled variety of GBM in your project, you should credit the
Open Source project for OpenJPEG. This code has been tested on OS/2 and Windows.
PNG support (extension to base version)
The official Open Source reference libraries Libpng 1.2.34 and Zlib
1.2.3 can be used to build GBM with PNG support. Try looking for
these libraries at:
I (Heiko Nitzsche) have donated gbmpng.c
and gbmmap.c
to GBM. These files allow GBM to use the Libpng 1.2.34 library.
GBM may be compiled up either with or without PNG support. If you use
the PNG enabled variety of GBM in your project, you should credit the
Open Source projects for Libpng and Zlib. This code has been tested on OS/2 and Windows.
TIF support (replacement of base version)
The official Open Source reference libraries Libtiff 3.8.2 can be
used to build GBM with TIF support. Required are Zlib 1.2.3 and the
IJG Group lib IJG 6b that is also used for standard JPEG support. Try
looking for these libraries at:
I (Heiko Nitzsche) have donated gbmtif.c
and gbmmap.c
to GBM. These files allow GBM to use the Libtiff 3.8.2 library.
GBM may be compiled up either with or without TIF support. If you
use the TIF enabled variety of GBM in your project, you should credit
the Open Source projects for Libtiff, Zlib and the IJG. This code has
been tested on OS/2 and Windows.
PBM support (extension to base version)
I (Heiko Nitzsche) have donated gbmpbm.c
to GBM. This file allows
GBM to read and write black/white PBM (binary P4, ASCII P1) files.
This code has been tested on OS/2 and Windows.
PGM support (enhancement of base version)
I (Heiko Nitzsche) have donated gbmpgm.c
to GBM. This file allows
GBM to read and write greyscale PGM (binary P5, ASCII P2) files.
This code has been tested on OS/2 and Windows.
PPM support (replacement of base version)
I (Heiko Nitzsche) have donated gbmppm.c
to GBM. This file allows
GBM to read and write unpalettised 24 and 48 bpp multipage RGB PPM (binary P6, ASCII P3) files.
This code has been tested on OS/2 and Windows.
PNM support (extension to base version)
I (Heiko Nitzsche) have donated gbmpnm.c
to GBM. This file allows
GBM to read and write PNM (binary P4,P5,P6, ASCII P1,P2,P3) files.
This code has been tested on OS/2 and Windows.
XPM support (extension to base version)
I (Heiko Nitzsche) have donated gbmxpm.c
and gbmxpmcn.c
to GBM.
These files allow GBM to read and write XPM2 and XPM3 files.
This code has been tested on OS/2 and Windows.
Related
code
GBM was originally written as the file handling part of
Andy Key's homebrew ray tracer, RT.
His follow-on Modular Renderer package, MR, uses GBM. It does
wire-frame, polygon rendering and raytracing.
From time to time I notice people (other than myself) using GBM
either in its precompiled DLL form, or by recompiling bits of the
source. Sometimes people email me to let me know.
Of course, simply using the code unmodified makes it easier for
you to pick up improvements in the code, as and when they happen.
Here are some example applications using GBM code.
GBM.DLL is used unmodified on OS/2 or eComStation by:
GBM code is internally used by:
- Maul Publisher uses GBM source code
in it's gbm handler code (OS/2, Windows).
- PM123 Digital Audio Player
uses GBM source code (OS/2). (see also: old pages)
- eSchemes Deluxe uses GBM source code in its MMOS2 Image I/O Procedures
- Papyrus apparently uses parts of GBM source code.
- IBM VisualAge C++ 3.0 uses large wedges of GBM source
code in their supplied
class IGBitmap
.
- IBM WebExplorer (OS/2) used the Bitmap, GIF and XBM handling parts of
GBM to some degree - in
webexwin.dll
.
- The IBM Person to Person personal conferencing system for OS/2 used the
PCX and TIFF parts of GBM, and I think the AIX variant used whole loads more.
- BluePaint, an OS/2 PM painting program uses GBM.DLL unmodified.
- BITMAP32, a bitmap viewer for OS/2 PM, uses GBM.DLL unmodified.
Because the IBM Developer Connection shipped BITMAP32, they shipped GBM too.
- ...