1Libnetpbm manual(3) Library Functions Manual Libnetpbm manual(3)
2
3
4
6 libnetpbm - general introduction to the netpbm library
7
9 libnetpbm is a C programming library for reading, writing, and manipu‐
10 lating Netpbm images. It also contains a few general graphics manipu‐
11 lation tools, but it is not intended to be a graphics tools library.
12 For graphics tools, Netpbm expects you to run the Netpbm programs.
13 From a C program, the libnetpbm function pm_system() makes this easy.
14 However, since it creates a process and execs a program, this may be
15 too heavyweight for some applications.
16
17 To use libnetpbm services in your C program, #include the pam.h inter‐
18 face header file. For historical reasons, you can also get by in some
19 cases with pbm.h, pgm.h, ppm.h, or pnm.h, but there's really no point
20 to that anymore.
21
22 The libnetpbm functions are divided into these categories:
23
24
25 · PBM functions. These have names that start with pbm and work
26 only on PBM images.
27
28 · PGM functions. These have names that start with pgm and work
29 only on PGM images.
30
31 · PPM functions. These have names that start with ppm and work
32 only on PPM images.
33
34 · PNM functions. These have names that start with pnm and work on
35 PBM, PGM, and PPM images.
36
37 · PAM functions. These also have names that start with pnm and
38 work on all the Netpbm image types.
39
40 · PM functions. These are utility functions that aren't specific
41 to any particular image format.
42
43
44 For new programming, you rarely need to concern yourself with the PBM,
45 PGM, PPM, and PNM functions, because the newer PAM functions do the
46 same thing and are easier to use. For certain processing of bi-level
47 images, the PBM functions are significantly more efficient, though.
48
49 libnetpbm has a backward compatibility feature that means a function
50 designed to read one format can read some others too, converting on the
51 fly. In particular, a function that reads a PGM image will also read a
52 PBM image, but converts it as it reads it so that for programming pur‐
53 poses, it is a PGM image. Similarly, a function that reads PPM can
54 read PBM and PGM as well. And a function that reads PBM, PGM, or PPM
55 can read a PAM that has an equivalent tuple type.
56
57 For each of the five classes of libnetpbm image processing functions,
58 libnetpbm has in in-memory representation for a pixel, a row, and a
59 whole image. Do not confuse this format with the actual image format,
60 as you would see in a file. The libnetpbm in-memory format is designed
61 to make programming very easy. It is sometimes extremely inefficient,
62 even more than the actual image format. For example, a pixel that a
63 PPM image represents with 3 bytes, libnetpbm's PAM functions represent
64 with 16 bytes. A pixel in a PBM image is represented by a single bit,
65 but the PNM functions represent that pixel in memory with 96 bits.
66
67 See LibnetpbmUser'sManual(1)forthe basics on using libnetpbm in a pro‐
68 gram.
69
70 You can look up the reference information for a particular function in
71 ThelibnetpbmDirectory(1).
72
73 Before Netpbm release 10 (June 2002), this library was split into four:
74 libpbm, libpgm, libppm, and libpnm. That's largely the reason for the
75 multiple sets of functions and scattered documentation.
76
77
78
79netpbm documentation December 2003 Libnetpbm manual(3)