LIBNETPBM(3)

πŸ“¦
version 11.13.03 Β· 2 versions
  • 11.13.03 Β· arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 11.9.3 Β· opensuse-leap 16.0
, in arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

libnetpbm β€” the general intro to the netpbm library, bestie πŸ’– (it's a section 3 thing, aka a library function, in case the (3) had you wondering)


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so libnetpbm is a C programming library for reading, writing, and manipulating Netpbm images. It also contains a few general graphics manipulation tools, but lowkey it is not meant to be a graphics tools library. For actual graphics tools, Netpbm expects you to just run the Netpbm programs. From a C program, the libnetpbm function pm_system() makes that super easy. BUT β€” and this is the catch β€” since it creates a process and execs a program, that can be too heavyweight for some applications. πŸ’€

To use libnetpbm services in your C program, #include the pam.h interface header file. For historical reasons, you can also get by in some cases with pbm.h, pgm.h, ppm.h, or pnm.h, but fr there's really no point to that anymore. πŸ™ˆ

The libnetpbm functions are divided into these categories:

  • PBM functions. These have names that start with pbm and work only on PBM images.
  • PGM functions. These have names that start with pgm and work only on PGM images.
  • PPM functions. These have names that start with ppm and work only on PPM images.
  • PNM functions. These have names that start with pnm and work on PBM, PGM, and PPM images.
  • PAM functions. These also have names that start with pnm and work on all the Netpbm image types.
  • PM functions. These are utility functions that aren't specific to any particular image format.

For new programming, you rarely need to concern yourself with the PBM, PGM, PPM, and PNM functions, because the newer PAM functions do the same thing and are easier to use. πŸ‘‘ For certain processing of bi-level images, though, the PBM functions are significantly more efficient β€” so like, don't sleep on those.

libnetpbm has a backward compatibility feature that means a function designed to read one format can read some others too, converting on the fly. ✨ In particular, a function that reads a PGM image will also read a PBM image, but converts it as it reads it so that for programming purposes, it is a PGM image. Similarly, a function that reads PPM can read PBM and PGM as well. And a function that reads PBM, PGM, or PPM can read a PAM that has an equivalent tuple type. It's giving ✨glow-up✨.

For each of the five classes of libnetpbm image processing functions, libnetpbm has an in-memory representation for a pixel, a row, and a whole image. ⚠️ Do not confuse this format with the actual image format, as you would see in a file. The libnetpbm in-memory format is designed to make programming very easy. It is sometimes extremely inefficient, even more than the actual image format. For example, a pixel that a PPM image represents with 3 bytes, libnetpbm's PAM functions represent with 16 bytes. 😭 And a pixel in a PBM image is represented by a single bit, but the PNM functions represent that pixel in memory with 96 bits. Like... 96. bestie. that's not a typo.

See Libnetpbm User's Manual(1) for the basics on using libnetpbm in a program. πŸ“–

You can look up the reference information for a particular function in The libnetpbm Directory(1). πŸ”

Before Netpbm release 10 (June 2002), this library was split into four: libpbm, libpgm, libppm, and libpnm. That's largely the reason for the multiple sets of functions and scattered documentation. (not me being haunted by my 2002 past πŸ’€)


🌸 DOCUMENT SOURCE 🌸

This manual page was generated by the Netpbm tool makeman from HTML source. The master documentation is at

http://netpbm.sourceforge.net/doc/libnetpbm.html

and that's the whole vibe check, bestie β€” this page is netpbm documentation, dated December 2003, brought to you with love πŸ’œ mwah, go write some slay C code πŸŽ€βœ¨

πŸ“¦ where this page comes from