PPMA Files
Portable Pixel Map (ASCII)
PPMA is the ASCII version of the portable pixel map PPM format.
It is a simple RGB color image description. The definition is as follows:
-
the typical file extension is ".ppm", but an extension of
".pnm" is also occasionally used.
-
A "magic number" for identifying the file type. An ASCII
PPM file's magic number is the two characters "P3".
-
Whitespace (blanks, TABs, CRs, LFs).
-
A width, formatted as ASCII characters in decimal.
-
Whitespace.
-
A height, again in ASCII decimal.
-
Whitespace.
-
The maximum color-component value, again in ASCII decimal.
-
Whitespace.
-
Width * height pixels, each three ASCII decimal values between 0 and
the specified maximum value, starting at the top-left corner of the
pixmap, proceeding in normal English reading order. The three values
for each pixel represent red, green, and blue, respectively; a value
of 0 means that color is off, and the maximum value means that color
is maxed out.
Characters from a "#" to the next end-of-line are ignored (comments).
No line should be longer than 70 characters.
Example PPMA File:
P3
# feep.ppma
4 4
15
0 0 0 0 0 0 0 0 0 15 0 15
0 0 0 0 15 7 0 0 0 0 0 0
0 0 0 0 0 0 0 15 7 0 0 0
15 0 15 0 0 0 0 0 0 0 0 0
PPMA File Characteristics:
-
ASCII
-
RGB color
-
2D
-
No compression
-
1 image
Related Data and Programs:
The PBMA data page
describes the ASCII Portable Bit Map format.
The PGMA data page
describes the ASCII Portable Gray Map format.
The PPMB data page
describes the binary Portable Pixel Map format.
Reference:
-
the NETPBM homepage.
Routines to create a PPMA file:
-
TABLE_BARPLOT_PPMA will read a TABLE file and create a
PPMA graphics file
representation of the data as a bar plot.
-
voronoi_plot
takes in a file of points in the unit square and creates a
PPMA file of the Voronoi diagram of the points, in any LP norm;
Programs and routines to read a PPMA file:
-
MATLAB can read a PPMA
file with a command like A=imread('file','PPM').
-
ppma_io,
a library of C++ routines;
-
ppma_io,
a library of FORTRAN90 routines;
-
ppma_io,
a library of MATLAB functions;
-
The Visual Toolkit
routine vtkPNMReader can read an ASCII
PPM file into VTK.
Programs and routines to write a PPMA file:
-
The gnuplot
command "set terminal pbm color".
-
MATLAB can write a PPMA
file with a command like imwrite(a,'filename','PPM').
-
The Open_GL,
graphics display can easily be written to
an ASCII PPM file. See the example "gasket_to_ppma.C".
-
ppma_io,
a library of C++ routines;
-
ppma_io,
a library of FORTRAN90 routines;
-
ppma_io,
a library of MATLAB functions;
-
The Visual Toolkit
routine vtkPNMWriter can write a VTK
image to an ASCII PPM file.
Programs to view a PPMA file:
-
The AVS module
read_any_image can read a PPMA file.
-
GIMP,
the GNU Image Manipulation Program, can view a PPMA file.
-
The Linux program
gqview,
can view a PPMA file.
-
The
ImageVision
program imgview can display a PPMA file.
-
MATLAB can display a PPMA
file, once it is read in, with a command like image(A).
-
The xv program
can view a PPMA file.
Programs to convert a PPMA file to another format:
-
cjpeg converts a
PPM file to JPEG format.
-
The
ImageMagick,
program convert can convert a PPMA 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 PPMA file and write out a copy in a variety of formats.
-
ppma_2_bmp converts a PPMA file to BMP format.
-
ppma_2_ppmb converts a PPMA (ASCII) file to PPMB (binary) format.
-
xv can read a PPMA file
and write out a copy in BMP, FIT, GIF, JPG, PBM, PGM, RGB or
TIF format.
Programs to convert a file to PPMA format:
Sample PPMA Files:
You can go up one level to
the DATA page.
Last revised on 20 June 2006.