PGMB Files
Portable Gray Map (binary)
PGMB files are the binary form of the portable gray map PGM format.
It is a simple gray map description. The definition is as follows:
-
the typical file extension is ".pgm", but an extension of
".pnm" is also occasionally used.
-
A "magic number" for identifying the file type. A
binary PGMB file's magic
number is the two characters "P5".
-
Whitespace (blanks, TABs, CRs, LFs).
-
A width, formatted as ASCII characters in decimal.
-
Whitespace.
-
A height, again in ASCII decimal.
-
Whitespace.
-
The maximum gray value, MAXVAL, again in ASCII decimal. MAXVAL
must be between 0 and 255.
-
A single character of whitespace, typically a newline;
-
Width * height gray values, each stored as a plain byte, between 0
and the
specified maximum value, separated by whitespace, starting at the
top-left corner of the graymap, proceeding in normal English
reading order.
A value of 0 means black, and the maximum value means white.
Characters from a "#" to the next end-of-line are ignored (comments).
PGMB File Characteristics:
-
binary
-
Gray scale only
-
2D
-
No compression
-
1 image
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Related Data and Programs:
The PBMB data directory
describes binary Portable Bit Map files.
The PGMA data directory
describes ASCII Portable Gray Map files.
The PPMB data directory
describes binary Portable Pixel Map files.
Reference:
-
the NETPBM homepage.
Programs and routines to read a PGMB file:
-
MATLAB can read a PGMB
file with a command like A=imread('file','PGM').
-
pbmlib, FORTRAN90 routines.
-
pgmb_io
C++ routines.
-
The Visual Toolkit
routine vtkPNMReader can read a binary
PGM file into VTK.
Programs and routines to write a PGMB file:
-
The gnuplot
command "set terminal pbm gray".
-
MATHEMATICA
includes an Export[filename,object] command
that can save a graphics object as a binary PGM file.
-
MATLAB can write a PGMB
file with a command like imwrite(a,'filename','PGM').
-
pbmlib, FORTRAN90 routines.
-
pgmb_io
C++ routines.
-
The Visual Toolkit
routine vtkPNMWriter can write a VTK
image to a binary PGM file.
Programs to view a PGMB file:
-
The
AVS
module read_any_image can read a PGMB file;
-
GIMP,
the GNU Image Manipulation Program, can read a PGMB file.
-
The
ImageVision
program imgview can display a PGMB file.
-
MATLAB can display a PGMB
file, once it is read in, with a command like image(A).
-
xv can display a PGMB file.
Programs to convert a PGMB file to another format:
-
cjpeg converts a
PGM to JPEG format.
-
The
ImageMagick,
program convert can convert a PGMB file to
BMP, CGM, EPS, FIG, FITS, GIF, JPG, PBM, PDF, PGM, PNG, PNM,
PPM, PS, RGB, TIF, XBM or XPM format.
-
GIMP,
the GNU Image Manipulation Program, can read a PGMB file
and write out a copy in a variety of formats.
-
PGMB_TO_PGMA
is a C++ program which can convert a PGMB file to
PGMA format.
-
The NETPBM program
PGMTOFITS converts a PGMB file to FITS format.
-
xv can read a PGMB file
and write out a copy in BMP, FIT, GIF, JPG, PBM, PPM, RGB or TIF
format.
Programs to convert a file to PGMB format:
-
The
ImageMagick,
program convert can convert a
BMP, CGM, EPS, FIG, FITS, GIF, JPG, PBM, PDF, PGM, PNG, PNM,
PPM, PS, RGB, TIF, XBM or XPM file to PGMB format.
-
djpeg
converts a JPEG file to PGM format.
-
GIMP,
the GNU Image Manipulation Program, can read a file in a
variety of formats, and write it out as a PGMB file.
-
The NETPBM program
FITSTOPGM converts a FITS file to PGMB format.
-
PGMA_TO_PGMB
is a C++ program which can convert a PGMA file to
PGMB format.
-
xv can read a file in a
BMP, FIT, GIF, JPG, PBM, PPM, RGB or TIF format, and write it out
as a PGMB file.
Sample PGMB Files:
You can go up one level to
the DATA page.
Last revised on 01 May 2006.