<s>
Netpbm	B-Language
(	O
formerly	O
Pbmplus	B-Language
)	O
is	O
an	O
open-source	B-Application
package	O
of	O
graphics	O
programs	O
and	O
a	O
programming	O
library	O
.	O
</s>
<s>
It	O
is	O
used	O
mainly	O
in	O
the	O
Unix	B-Application
world	O
,	O
where	O
one	O
can	O
find	O
it	O
included	O
in	O
all	O
major	O
open-source	B-Application
operating	B-General_Concept
system	I-General_Concept
distributions	O
,	O
but	O
also	O
works	O
on	O
Microsoft	B-Application
Windows	I-Application
,	O
macOS	B-Application
,	O
and	O
other	O
operating	B-General_Concept
systems	I-General_Concept
.	O
</s>
<s>
Several	O
graphics	O
formats	O
are	O
used	O
and	O
defined	O
by	O
the	O
Netpbm	B-Language
project	O
:	O
</s>
<s>
The	O
PBM	O
format	O
was	O
invented	O
by	O
Jef	O
Poskanzer	O
in	O
the	O
1980s	O
as	O
a	O
format	O
that	O
allowed	O
monochrome	O
bitmaps	O
to	O
be	O
transmitted	O
within	O
an	O
email	O
message	O
as	O
plain	O
ASCII	B-Protocol
text	I-Protocol
,	O
allowing	O
it	O
to	O
survive	O
any	O
changes	O
in	O
text	O
formatting	O
.	O
</s>
<s>
Poskanzer	O
developed	O
the	O
first	O
library	O
of	O
tools	O
to	O
handle	O
the	O
PBM	O
format	O
,	O
Pbmplus	B-Language
,	O
released	O
in	O
1988	O
.	O
</s>
<s>
By	O
the	O
end	O
of	O
1988	O
,	O
Poskanzer	O
had	O
developed	O
the	O
PGM	O
and	O
PPM	O
formats	O
along	O
with	O
their	O
associated	O
tools	O
and	O
added	O
them	O
to	O
Pbmplus	B-Language
.	O
</s>
<s>
The	O
final	O
release	O
of	O
Pbmplus	B-Language
was	O
December	O
10	O
,	O
1991	O
.	O
</s>
<s>
In	O
1993	O
,	O
the	O
Netpbm	B-Language
library	O
was	O
developed	O
to	O
replace	O
the	O
unmaintained	O
Pbmplus	B-Language
.	O
</s>
<s>
It	O
was	O
simply	O
a	O
repackaging	O
of	O
Pbmplus	B-Language
with	O
additions	O
and	O
fixes	O
submitted	O
by	O
people	O
all	O
over	O
the	O
world	O
.	O
</s>
<s>
Each	O
file	O
starts	O
with	O
a	O
two-byte	O
magic	O
number	O
(	O
in	O
ASCII	B-Protocol
)	O
that	O
identifies	O
the	O
type	O
of	O
file	O
it	O
is	O
(	O
PBM	O
,	O
PGM	O
,	O
and	O
PPM	O
)	O
and	O
its	O
encoding	O
(	O
ASCII/	O
"	O
plain	O
"	O
or	O
binary/	O
"	O
raw	O
"	O
)	O
.	O
</s>
<s>
A	O
value	O
of	O
P7	O
refers	O
to	O
the	O
PAM	O
file	O
format	O
that	O
is	O
covered	O
as	O
well	O
by	O
the	O
netpbm	B-Language
library	O
.	O
</s>
<s>
The	O
ASCII	B-Protocol
(	O
"	O
plain	O
"	O
)	O
formats	O
allow	O
for	O
human	O
readability	O
and	O
easy	O
transfer	O
to	O
other	O
platforms	O
;	O
the	O
binary	O
(	O
"	O
raw	O
"	O
)	O
formats	O
are	O
more	O
efficient	O
in	O
file	O
size	O
but	O
may	O
have	O
native	O
byte-order	O
issues	O
.	O
</s>
<s>
The	O
file	O
data	O
does	O
n't	O
store	O
information	O
which	O
color	B-Algorithm
space	I-Algorithm
it	O
is	O
using	O
,	O
and	O
must	O
be	O
chosen	O
by	O
the	O
user	O
or	O
other	O
software	O
.	O
</s>
<s>
However	O
it	O
is	O
very	O
common	O
to	O
store	O
color	O
using	O
sRGB	O
color	B-Algorithm
space	I-Algorithm
,	O
or	O
sometimes	O
using	O
linear	O
color	B-Algorithm
space	I-Algorithm
.	O
</s>
<s>
The	O
PGM	O
and	O
PPM	O
formats	O
(	O
both	O
ASCII	B-Protocol
and	O
binary	O
versions	O
)	O
have	O
an	O
additional	O
parameter	O
for	O
the	O
maximum	O
value	O
(	O
numbers	O
of	O
grey	O
between	O
black	O
and	O
white	O
)	O
after	O
the	O
X	O
and	O
Y	O
dimensions	O
and	O
before	O
the	O
actual	O
pixel	O
data	O
.	O
</s>
<s>
The	O
P6	O
binary	O
format	O
of	O
the	O
same	O
image	O
represents	O
each	O
color	B-Algorithm
component	I-Algorithm
of	O
each	O
pixel	O
with	O
one	O
byte	O
(	O
thus	O
three	O
bytes	O
per	O
pixel	O
)	O
in	O
the	O
order	O
red	O
,	O
green	O
,	O
then	O
blue	O
.	O
</s>
<s>
The	O
header	O
remains	O
in	O
ASCII	B-Protocol
and	O
the	O
arguments	O
are	O
still	O
separated	O
by	O
a	O
whitespace	O
.	O
</s>
<s>
(	O
at	O
least	O
,	O
that	O
is	O
how	O
image-manipulation	O
program	O
Gimp	B-Application
displays	O
it	O
(	O
december	O
2022	O
)	O
)	O
.	O
</s>
<s>
While	O
the	O
ASCII	B-Protocol
format	O
can	O
accommodate	O
greater	O
bit	O
depths	O
,	O
it	O
increases	O
file	O
size	O
and	O
thus	O
slows	O
read	O
and	O
write	O
operations	O
.	O
</s>
<s>
In	O
Netpbm	B-Language
,	O
the	O
de	O
facto	O
standard	O
implementation	O
of	O
the	O
PNM	O
formats	O
,	O
the	O
most	O
significant	O
byte	O
is	O
first	O
.	O
</s>
<s>
The	O
first	O
line	O
is	O
either	O
the	O
ASCII	B-Protocol
text	I-Protocol
"	O
PF	O
"	O
,	O
for	O
a	O
color	O
file	O
,	O
or	O
"	O
Pf	O
"	O
,	O
for	O
a	O
grey-scale	O
file	O
.	O
</s>
<s>
The	O
next	O
ASCII	B-Protocol
text	I-Protocol
line	O
contains	O
the	O
width	O
and	O
height	O
,	O
separated	O
by	O
the	O
space	O
character	O
hex	O
20	O
or	O
sometimes	O
with	O
hex	O
0A	O
(	O
resulting	O
in	O
four	O
lines	O
)	O
.	O
</s>
<s>
The	O
third	O
ASCII	B-Protocol
text	I-Protocol
line	O
holds	O
a	O
nonzero	O
decimal	O
number	O
that	O
indicates	O
little	O
endian	O
floats	O
for	O
the	O
pixel	O
data	O
when	O
negative	O
and	O
big-endian	O
floats	O
when	O
positive	O
.	O
</s>
<s>
PFM	O
is	O
supported	O
by	O
the	O
programs	O
Photoshop	B-Operating_System
,	O
GIMP	B-Application
,	O
and	O
ImageMagick	B-Language
.	O
</s>
<s>
It	O
is	O
supported	O
by	O
the	O
de	O
facto	O
reference	O
implementation	O
netpbm	B-Language
.	O
</s>
<s>
Netpbm	B-Language
contains	O
over	O
220	O
separate	O
programs	O
in	O
the	O
package	O
,	O
most	O
of	O
which	O
have	O
"	O
pbm	O
"	O
,	O
"	O
pgm	O
"	O
,	O
"	O
ppm	O
"	O
,	O
"	O
pam	O
"	O
,	O
or	O
"	O
pnm	O
"	O
in	O
their	O
names	O
.	O
</s>
<s>
The	O
Netpbm	B-Language
package	O
can	O
,	O
for	O
example	O
,	O
use	O
two	O
successive	O
conversion	O
programs	O
to	O
turn	O
a	O
picture	O
in	O
the	O
PBM	O
format	O
into	O
a	O
.bmp	B-Device
file	O
:	O
</s>
<s>
This	O
is	O
more	O
commonly	O
done	O
as	O
a	O
pipeline	B-Operating_System
,	O
to	O
save	O
execution	O
time	O
and	O
to	O
avoid	O
leaving	O
a	O
temporary	O
somepic.ppm	O
file	O
around	O
:	O
</s>
<s>
The	O
Netpbm	B-Language
programs	O
are	O
frequently	O
used	O
as	O
intermediates	O
to	O
convert	O
between	O
obscure	O
formats	O
.	O
</s>
<s>
For	O
instance	O
,	O
there	O
may	O
be	O
no	O
tool	O
to	O
convert	O
an	O
X11	O
window	O
dump	O
(	O
XWD	B-Protocol
format	O
)	O
directly	O
to	O
a	O
Macintosh	O
PICT	B-Language
file	O
,	O
but	O
one	O
can	O
do	O
this	O
by	O
running	O
xwdtopnm	O
,	O
then	O
ppmtopict	O
.	O
</s>
<s>
As	O
a	O
more	O
complex	O
example	O
,	O
Netpbm	B-Language
tools	O
can	O
convert	O
48×48	O
XBM	B-Device
to	O
Ikon	O
and	O
eventually	O
X-Face	B-Application
.	O
</s>
<s>
At	O
the	O
time	O
,	O
there	O
was	O
no	O
standard	O
,	O
reliable	O
way	O
to	O
send	O
binary	O
files	O
in	O
email	O
,	O
and	O
attempting	O
to	O
send	O
anything	O
other	O
than	O
7-bit	B-Protocol
ASCII	I-Protocol
in	O
email	O
often	O
resulted	O
in	O
data	O
corruption	O
.	O
</s>
<s>
Poskanzer	O
released	O
the	O
forerunner	O
of	O
Netpbm	B-Language
,	O
called	O
Pbmplus	B-Language
in	O
1988	O
.	O
</s>
<s>
By	O
the	O
end	O
of	O
1988	O
,	O
Poskanzer	O
had	O
developed	O
the	O
PGM	O
(	O
greyscale	O
)	O
and	O
PPM	O
(	O
color	O
)	O
formats	O
and	O
released	O
them	O
with	O
Pbmplus	B-Language
.	O
</s>
<s>
The	O
last	O
release	O
of	O
Pbmplus	B-Language
was	O
on	O
December	O
10	O
,	O
1991	O
.	O
</s>
<s>
Poskanzer	O
never	O
released	O
any	O
further	O
updates	O
,	O
and	O
in	O
1993	O
,	O
Netpbm	B-Language
was	O
developed	O
to	O
replace	O
it	O
.	O
</s>
<s>
At	O
first	O
,	O
it	O
was	O
nothing	O
more	O
than	O
a	O
renamed	O
release	O
of	O
Pbmplus	B-Language
,	O
but	O
updates	O
continued	O
to	O
occur	O
until	O
1995	O
when	O
the	O
package	O
again	O
became	O
abandoned	O
.	O
</s>
<s>
In	O
1999	O
,	O
the	O
Netpbm	B-Language
package	O
was	O
picked	O
up	O
by	O
its	O
present	O
maintainer	O
,	O
Bryan	O
Henderson	O
.	O
</s>
<s>
In	O
2000	O
,	O
PAM	O
was	O
added	O
to	O
the	O
file	O
formats	O
of	O
the	O
Netpbm	B-Language
library	O
allowing	O
an	O
alpha	B-Algorithm
channel	I-Algorithm
.	O
</s>
<s>
The	O
name	O
Netpbm	B-Language
came	O
from	O
the	O
program	O
developers	O
collaborating	O
over	O
the	O
Internet	O
,	O
which	O
was	O
notable	O
at	O
the	O
time	O
;	O
the	O
NetBSD	B-Device
operating	B-General_Concept
system	I-General_Concept
and	O
NetHack	B-Application
game	O
got	O
their	O
names	O
similarly	O
.	O
</s>
<s>
Portable	O
Arbitrary	O
Map	O
(	O
PAM	O
)	O
is	O
an	O
extension	O
of	O
the	O
older	O
binary	O
P4	O
...	O
P6	O
graphics	O
formats	O
,	O
introduced	O
with	O
netpbm	B-Language
version	O
9.7	O
(	O
August	O
2000	O
)	O
.	O
</s>
<s>
The	O
tuple	O
type	O
attribute	O
specifies	O
what	O
kind	O
of	O
image	O
the	O
PAM	O
file	O
represents	O
,	O
thus	O
enabling	O
it	O
to	O
stand	O
for	O
the	O
older	O
Netpbm	B-Language
formats	O
,	O
as	O
well	O
as	O
to	O
be	O
extended	O
to	O
new	O
uses	O
,	O
e.g.	O
,	O
transparency	O
.	O
</s>
<s>
PAM	O
is	O
supported	O
by	O
XnView	B-Protocol
and	O
FFmpeg	B-Library
.	O
</s>
<s>
As	O
specified	O
the	O
TUPLTYPE	O
is	O
optional	O
;	O
however	O
,	O
FFmpeg	B-Library
requires	O
it	O
.	O
</s>
<s>
There	O
is	O
no	O
plain	O
(	O
human-readable	O
,	O
ASCII-based	O
)	O
version	O
of	O
PAM	O
.	O
</s>
<s>
PAM	O
files	O
are	O
always	O
binary	O
,	O
and	O
attempts	O
to	O
use	O
the	O
switch	O
-plain	O
with	O
Netpbm	B-Language
programs	O
that	O
produce	O
PAM	O
output	O
results	O
in	O
an	O
error	O
message	O
.	O
</s>
<s>
All	O
of	O
the	O
basic	O
tuple	O
types	O
(	O
BLACKANDWHITE	O
,	O
GRAYSCALE	O
,	O
and	O
RGB	O
)	O
have	O
a	O
variant	O
with	O
an	O
opacity	B-Algorithm
channel	I-Algorithm
.	O
</s>
<s>
An	O
example	O
in	O
the	O
BMP	B-Device
article	O
shows	O
an	O
RGBA	O
image	O
with	O
4×2	O
=	O
8	O
blue	O
,	O
green	O
,	O
red	O
,	O
and	O
white	O
pixels	O
;	O
half	O
transparent	O
(	O
0x7F	O
)	O
in	O
the	O
first	O
lower	O
row	O
,	O
opaque	O
(	O
0xFF	O
)	O
in	O
the	O
second	O
upper	O
row	O
;	O
hex	O
.	O
</s>
<s>
BMP	B-Device
rows	O
are	O
typically	O
arranged	O
bottom-up	O
,	O
for	O
PAM	O
and	O
PNM	O
rows	O
are	O
given	O
top-down	O
(	O
i.e.	O
</s>
<s>
Some	O
programs	O
of	O
the	O
Netpbm	B-Language
package	O
,	O
for	O
example	O
pamsummcol	O
,	O
function	O
as	O
crude	O
matrix	O
arithmetic	O
processors	O
and	O
use	O
the	O
PAM	O
format	O
this	O
way	O
.	O
</s>
<s>
Netpbm	B-Language
consists	O
of	O
hundreds	O
of	O
different	O
tools	O
,	O
each	O
with	O
a	O
license	O
of	O
their	O
own	O
.	O
</s>
