ppm is the abbreviation for parts per million, a measure often used in very small concentrations of gasses. It is also used in specifying the accuracy of the crystals used in electronic devices, and in many situations when the percentage is much less than 1%.

Calculation of ppm is simple for anyone who can calculate a percentage; the procedure is the same, except you multiply by 10^6 (one million) rather than 10^2 (one hundred). This also means you can convert from a percentage to ppm by multiplying by 10^4 (ten thousand), and convert back from ppm to percentage by dividing by the same amount

For example, marijuana can have a THC concentration of between 5 and 20 percent. These percentages are large and easy to work with. Hemp-based edible oils, on the other hand, have THC concentrations of only about 0.005%. Since exponential notation looks a bit silly next to a percentage sign, the best way to get rid of those zeros to the right of the decimal point is to use ppm. Simply multiplying 0.005 by 10000 gives us 50 ppm. Easy!

Within the world of graphics (primarily Unix) PPM stands for "Portable PixMap" and acts as the absolute lowest common denominator for color images (its kin the pgm and pbm handle gray-scale and bitmap images).

The default (ASCII) file format is quite simple:

```P3
X Y
MAX
R G B  R G B  R G B ...
.
.
.
```
The 'P3' is a "magic number" in the Unix world which aids in identifying files. Rather than relying upon the extension of a file to see what something is ('.ppm'), Unix looks into a file as described in '/etc/magic' and uses that to identify files. The following is the section describing ppm and its kin:
```# PBMPLUS
0  string  P1  image/x-portable-bitmap  7bit
0  string  P2  image/x-portable-greymap 7bit
0  string  P3  image/x-portable-pixmap  7bit
0  string  P4  image/x-portable-bitmap
0  string  P5  image/x-portable-greymap
0  string  P6  image/x-portable-pixmap
```
This is read as 'Starting at byte 0, look at the first string. If it is P1, then the file is a 7bit (ASCII) image/x-portable-bitmap'.

The second set of values in the ppm file are two numbers (in ASCII decimal) that are separated by some whitespace (some number of tabs and spaces or linefeeds) - it doesn't matter how much, as long as there is some space between them). These are shown above as X Y and are the X and Y dimensions of the image.

The third line is a single number that represents the range of color. Classically this will be a power of 2 - 1. If this number is '256' then the triplet '255 255 255' represents white and '128 128 128' is a 50% gray. However, if the number is '15' then '15 15 15' is white and '8 8 8' is a 50% gray.

From this point on, triplets of numbers (again in ASCII decimal) represent RGB values. The following sample is from the ppm man page:

```P3
# feep.ppm
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
```
This produces a 4x4 image with magenta in the outer upper right and outer lower left and a lime green in the inner upper left and lower right. All of the other spots are black.

Comments may be added anywhere in the file and are designated by a '#' which causes the parser to ignore that point to the end of the line.

While its not required, it is recommended that no line be longer than 70 characters. This likely dates back to the days of the punch cards (80 col wide) allowing for 70 characters, a space and a '#' sign and then the 8 characters for comments. These 8 characters would most often be used for sequence information in case a deck got shuffled. As Fortran also used the last 8 characters of a line for comments most anyone who used punch cards had a program to sort a deck by values in the last 8 bytes on the card.

The astute reader will recognize that there are two entries for 'image/x-portable-pixmap' in the magic number file above. This is because there are two formats. The second one is a bit smaller and faster to work with than the ASCII form that was described above and uses raw bytes for the image map rather than decimal values. This does pose the limitation that the maximum value for a particular color is limited to (and often set at) 255. If the RAWBITS format is used, after the newline for the maximum value for a color, you've got raw data as bytes. Instead of '0' you have '0x00' and instead of '255' the value is '0xFF'. This results from a 2x decrease in (' 0' (2 bytes) to '0x00' (1 byte)) to a 4x decrease in the space used (' 255' (4 bytes) to '0xFF' (1 byte)). This will be more if more whitespace is used for easier human reading (as above).

So, why have it at all? This file format is not intended to be used for anything other than an intermediary between two other graphics file formats. The reason it has come about is for simplification in the world of conversion graphics files. Consider 20 file formats (thats the number listed in the ppm man page). You want to convert between these formats. If one was to write one program for each pair (or worse - two programs, one for each direction of translation) you'd have 380 (20 * 19) programs. Instead, there are 20 programs tiled '???toppm' and another 20 titled 'ppmto???'. Each one of these programs translates to or from the ppm file format and one other file format. Each of these programs is easier to write and debug than any one of the 380 ones that are not written.

Pulse Position Modulation - This is a communication modulation scheme used to improve power and/or bandwidth efficency. The basic idea is simple: Make the position of a pulse within a window meaningful and interpret it to mean a specific bit was sent.

For instance, let's pretend that we have a simplistic scheme where we want to communicate with our buddy across the street using flashlights. We use binary and agree to send a flash once a second (on for 1, off for 0). This is works fine but it's pretty slow (the messsage: "I hate my sister" for instance takes so long to send that she's just not worth the effort. In order to send more information, you and your buddy have two options, increase the clock rate (send flashes 10 time a second) or use PPM.

In PPM, we divide the time interval (in this case 1 second) into some number of slots, say 8 (each 1/8th of a second long). You and your friend can now communicate in oct-ary (or whatever you call base 8 communication). There are 8 different choices per second that could be sent which means it's like 8 bits being sent per second (one byte/second).

This is a pretty simplistic model but the idea is the same for much more complex systems. Folks have come up with lots of different variations on the idea of PPM including some called, Multiple PPM (MPPM), Combinatorial PPM (CPPM), Overlapping PPM (OPPM), and Differential PPM (DPPM).

Log in or register to write something here or to contact authors.