| 1 |
\ |
| 2 |
.\" This man page was generated by the Netpbm tool 'makeman' from HTML source. |
| 3 |
.\" Do not hand-hack it! If you have bug fixes or improvements, please find |
| 4 |
.\" the corresponding HTML page on the Netpbm website, generate a patch |
| 5 |
.\" against that, and send it to the Netpbm maintainer. |
| 6 |
.TH "User manual for Netpbm" 1 "08 August 2020" "netpbm documentation" |
| 7 |
|
| 8 |
.SH NAME |
| 9 |
netpbm - netpbm library overview |
| 10 |
|
| 11 |
.UN overview |
| 12 |
.SH Overview Of Netpbm |
| 13 |
.UN overview |
| 14 |
.PP |
| 15 |
\fBNetpbm\fP is a package of graphics programs and a programming |
| 16 |
library. |
| 17 |
.PP |
| 18 |
There are over 330 separate programs in the package, most of |
| 19 |
which have "pbm", "pgm", "ppm", "pam", or "pnm" in their names. For example, |
| 20 |
.BR "pamscale" (1)\c |
| 21 |
\& and |
| 22 |
.BR "giftopnm" (1)\c |
| 23 |
\&. |
| 24 |
.PP |
| 25 |
For example, you might use \fBpamscale\fP to shrink an image by |
| 26 |
10%. Or use \fBpamcomp\fP to overlay one image on top of another. |
| 27 |
Or use \fBpbmtext\fP to create an image of text. Or reduce the number |
| 28 |
of colors in an image with \fBpnmquant\fP. |
| 29 |
.PP |
| 30 |
\fBNetpbm\fP is an open source software package, distributed via |
| 31 |
the |
| 32 |
.UR http://sourceforge.net/projects/netpbm |
| 33 |
Sourceforge \fBnetpbm\fP project |
| 34 |
.UE |
| 35 |
\&. |
| 36 |
|
| 37 |
.UN index |
| 38 |
.SH Table Of Contents |
| 39 |
|
| 40 |
.IP \(bu |
| 41 |
.UR #overview |
| 42 |
Overview Of Netpbm |
| 43 |
.UE |
| 44 |
\& |
| 45 |
.IP \(bu |
| 46 |
.UR #formats |
| 47 |
The Netpbm Formats |
| 48 |
.UE |
| 49 |
\& |
| 50 |
|
| 51 |
.IP \(bu |
| 52 |
.UR #impconv |
| 53 |
Implied Format Conversion |
| 54 |
.UE |
| 55 |
\& |
| 56 |
.IP \(bu |
| 57 |
.UR #transparency |
| 58 |
Netpbm and Transparency |
| 59 |
.UE |
| 60 |
\& |
| 61 |
|
| 62 |
.IP \(bu |
| 63 |
.UR #programs |
| 64 |
The Netpbm Programs |
| 65 |
.UE |
| 66 |
\& |
| 67 |
|
| 68 |
.IP \(bu |
| 69 |
.UR #commonoptions |
| 70 |
Common Options |
| 71 |
.UE |
| 72 |
\& |
| 73 |
.IP \(bu |
| 74 |
.UR #directory |
| 75 |
Directory |
| 76 |
.UE |
| 77 |
\& |
| 78 |
.IP \(bu |
| 79 |
.UR #prognotes |
| 80 |
How To Use The Programs |
| 81 |
.UE |
| 82 |
\& |
| 83 |
|
| 84 |
.IP \(bu |
| 85 |
.UR #libnetpbm |
| 86 |
The Netpbm Library |
| 87 |
.UE |
| 88 |
\& |
| 89 |
.IP \(bu |
| 90 |
.UR #config |
| 91 |
netpbm-config |
| 92 |
.UE |
| 93 |
\& |
| 94 |
.IP \(bu |
| 95 |
.UR #memoryusage |
| 96 |
Memory Usage |
| 97 |
.UE |
| 98 |
\& |
| 99 |
.IP \(bu |
| 100 |
.UR #cpuusage |
| 101 |
CPU Usage |
| 102 |
.UE |
| 103 |
\& |
| 104 |
.IP \(bu |
| 105 |
.UR #netpbmforgimp |
| 106 |
Netpbm For Gimp |
| 107 |
.UE |
| 108 |
\& |
| 109 |
.IP \(bu |
| 110 |
.UR #companion |
| 111 |
Companion Software |
| 112 |
.UE |
| 113 |
\& |
| 114 |
|
| 115 |
.IP \(bu |
| 116 |
.UR #phpnetpbm |
| 117 |
PHP-NetPBM |
| 118 |
.UE |
| 119 |
\& |
| 120 |
|
| 121 |
.IP \(bu |
| 122 |
.UR #othersoftware |
| 123 |
Other Graphics Software |
| 124 |
.UE |
| 125 |
\& |
| 126 |
|
| 127 |
.IP \(bu |
| 128 |
.UR #viewers |
| 129 |
Image Viewers |
| 130 |
.UE |
| 131 |
\& |
| 132 |
.IP \(bu |
| 133 |
.UR #capturers |
| 134 |
Image Capturers |
| 135 |
.UE |
| 136 |
\& |
| 137 |
.IP \(bu |
| 138 |
.UR #visual |
| 139 |
Visual Graphics Software |
| 140 |
.UE |
| 141 |
\& |
| 142 |
.IP \(bu |
| 143 |
.UR #programmingtools |
| 144 |
Programming Tools |
| 145 |
.UE |
| 146 |
\& |
| 147 |
.IP \(bu |
| 148 |
.UR #toolsforformats |
| 149 |
Tools For Specific Graphics Formats |
| 150 |
.UE |
| 151 |
\& |
| 152 |
.IP \(bu |
| 153 |
.UR #document |
| 154 |
Document/Graphics Software |
| 155 |
.UE |
| 156 |
\& |
| 157 |
.IP \(bu |
| 158 |
.UR #otherothersoftware |
| 159 |
Other |
| 160 |
.UE |
| 161 |
\& |
| 162 |
|
| 163 |
.IP \(bu |
| 164 |
.UR #otherfmt |
| 165 |
Other Graphics Formats |
| 166 |
.UE |
| 167 |
\& |
| 168 |
.IP \(bu |
| 169 |
.UR #history |
| 170 |
History |
| 171 |
.UE |
| 172 |
\& |
| 173 |
.IP \(bu |
| 174 |
.UR #author |
| 175 |
Author |
| 176 |
.UE |
| 177 |
\& |
| 178 |
|
| 179 |
|
| 180 |
.UN programs |
| 181 |
.SH The Netpbm Programs |
| 182 |
.PP |
| 183 |
The Netpbm programs are generally useful run by a person from a |
| 184 |
command shell, but are also designed to be used by programs. A common |
| 185 |
characteristic of Netpbm programs is that they are simple, fundamental |
| 186 |
building blocks. They are most powerful when stacked in pipelines. |
| 187 |
Netpbm programs do not use graphical user interfaces and do not seek |
| 188 |
input from a user. The only programs that display graphics at all are |
| 189 |
the very primitive display programs \fBpamx\fP and \fBppmsvgalib\fP, |
| 190 |
and they don't do anything but that. |
| 191 |
.PP |
| 192 |
Each of these programs has its own manual, as linked in the |
| 193 |
directory below. |
| 194 |
.PP |
| 195 |
The Netpbm programs can read and write files greater than 2 GiB wherever |
| 196 |
the underlying system can. There may be exceptions where the programs use |
| 197 |
external libraries (The JPEG library, etc.) to access files and the external |
| 198 |
library does not have large file capability. Before Netpbm 10.15 (April |
| 199 |
2003), no Netpbm program could read a file that large. |
| 200 |
|
| 201 |
.UN commonoptions |
| 202 |
.SS Common Options |
| 203 |
.PP |
| 204 |
There are a few options that are present on all programs that are based |
| 205 |
on the Netpbm library, including virtually all Netpbm programs. These |
| 206 |
are not mentioned in the individual manuals for the programs. |
| 207 |
.PP |
| 208 |
You can use two hyphens instead of one on these options if you like. |
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
.TP |
| 213 |
\fB-quiet\fP |
| 214 |
Suppress all informational messages that would otherwise be |
| 215 |
issued to Standard Error. (To be precise, this only works to the |
| 216 |
extent that the program in question implements the Netpbm convention |
| 217 |
of issuing all informational messages via the \fBpm_message()\fP |
| 218 |
service of the Netpbm library). |
| 219 |
|
| 220 |
.TP |
| 221 |
\fB-version\fP |
| 222 |
Instead of doing anything else, report the version of the |
| 223 |
\fBlibnetpbm\fP library linked with the program (it may have been |
| 224 |
linked statically into the program, or dynamically linked at run |
| 225 |
time). Normally, the Netpbm programs and the library are installed |
| 226 |
at the same time, so this tells you the version of the program and all |
| 227 |
the other Netpbm files it uses as well. |
| 228 |
|
| 229 |
.TP |
| 230 |
\fB-plain\fP |
| 231 |
If the program generates an image in PNM format, generate it in the |
| 232 |
"plain" (aka "ascii") version of the format, as opposed to the "raw" (aka |
| 233 |
"binary") version. |
| 234 |
.sp |
| 235 |
Note that the other Netpbm format, PAM, does not have plain and raw |
| 236 |
versions, so this option has no effect on a program that generates PAM output. |
| 237 |
.sp |
| 238 |
This option was introduced in Netpbm 10.10 (October 2002). From Netpbm 10.32 |
| 239 |
(February 2006) through Netpbm 10.62 (March 2013), the option is invalid with |
| 240 |
a program that generates PAM output (instead of ignoring the option, the |
| 241 |
program fails). |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
.UN directory |
| 246 |
.SS Directory |
| 247 |
.PP |
| 248 |
Here is a complete list of all the Netpbm programs (with links to |
| 249 |
their manuals): |
| 250 |
.PP |
| 251 |
.BR "Netpbm program directory" (1)\c |
| 252 |
\& |
| 253 |
|
| 254 |
|
| 255 |
.UN prognotes |
| 256 |
.SS How To Use The Programs |
| 257 |
.PP |
| 258 |
As a collection of primitive tools, the power of Netpbm is multiplied |
| 259 |
by the power of all the other unix tools you can use with them. These |
| 260 |
notes remind you of some of the more useful ways to do this. Often, |
| 261 |
when people want to add high level functions to the Netpbm tools, they |
| 262 |
have overlooked some existing tool that, in combination with Netpbm, |
| 263 |
already does it. |
| 264 |
.PP |
| 265 |
Often, you need to apply some conversion or edit to a whole bunch of files. |
| 266 |
.PP |
| 267 |
As a rule, Netpbm programs take one input file and produce one output file, |
| 268 |
usually on Standard Output. This is for flexibility, since you so often |
| 269 |
have to pipeline many tools together. |
| 270 |
.PP |
| 271 |
Here is an example of a shell command to convert all your PNG files (named |
| 272 |
*.png) to JPEG files named *.jpg: |
| 273 |
.nf |
| 274 |
for i in *.png; do pngtopam $i | pnmtojpeg >`basename $i .png`.jpg; done |
| 275 |
|
| 276 |
.fi |
| 277 |
.PP |
| 278 |
Or you might just generate a stream of individual shell commands, one |
| 279 |
per file, with awk or perl. Here's how to brighten 30 YUV images that |
| 280 |
make up one second of a movie, keeping the images in the same files: |
| 281 |
|
| 282 |
.nf |
| 283 |
ls *.yuv |
| 284 |
| perl -ne 'chomp; |
| 285 |
print yuvtoppm $_ | pambrighten -value +100 | ppmtoyuv >tmp$$.yuv; |
| 286 |
mv tmp$$.yuv $_ |
| 287 |
' |
| 288 |
| sh |
| 289 |
|
| 290 |
.fi |
| 291 |
.PP |
| 292 |
The tools \fBfind\fP (with the \fB-exec\fP option) and |
| 293 |
\fBxargs\fP are also useful for simple manipulation of groups of files. |
| 294 |
.PP |
| 295 |
Some shells' "process substitution" facility can help where a |
| 296 |
non-Netpbm program expects you to identify a disk file for input and |
| 297 |
you want it to use the result of a Netpbm manipulation. Say |
| 298 |
the hypothetical program \fBprintcmyk\fP |
| 299 |
takes the filename of a Tiff CMYK file as input and what you have is a |
| 300 |
PNG file |
| 301 |
\fBabc.png\fP. |
| 302 |
|
| 303 |
Try: |
| 304 |
.nf |
| 305 |
printcmyk <({ pngtopam abc.png | pnmtotiffcmyk ; }) |
| 306 |
|
| 307 |
.fi |
| 308 |
.PP |
| 309 |
It works in the other direction too, if you have a program that |
| 310 |
makes you name its output file and you want the output to go through a |
| 311 |
Netpbm tool. |
| 312 |
|
| 313 |
|
| 314 |
.UN formats |
| 315 |
.SH The Netpbm Formats |
| 316 |
.PP |
| 317 |
All of the programs work with a set of graphics formats called the |
| 318 |
"netpbm" formats. Specifically, these formats are |
| 319 |
.BR "pbm" (1)\c |
| 320 |
\&, |
| 321 |
.BR "pgm" (1)\c |
| 322 |
\&, |
| 323 |
.BR "ppm" (1)\c |
| 324 |
\&, |
| 325 |
and |
| 326 |
.BR "pam" (1)\c |
| 327 |
\&. |
| 328 |
|
| 329 |
The first three of these are sometimes known generically as |
| 330 |
"pnm". |
| 331 |
|
| 332 |
Many of the Netpbm programs convert from a Netpbm format to another |
| 333 |
format or vice versa. This is so you can use the Netpbm programs to |
| 334 |
work on graphics of any format. It is also common to use a |
| 335 |
combination of Netpbm programs to convert from one non-Netpbm format |
| 336 |
to another non-Netpbm format. Netpbm has converters for about 100 |
| 337 |
graphics formats, and as a package Netpbm lets you do more graphics |
| 338 |
format conversions than any other computer graphics facility. |
| 339 |
.PP |
| 340 |
The Netpbm formats are all raster formats, i.e. they describe an image |
| 341 |
as a matrix of rows and columns of pixels. In the PBM format, the |
| 342 |
pixels are black and white. In the PGM format, pixels are shades of |
| 343 |
gray. In the PPM format, the pixels are in full color. The PAM format |
| 344 |
is more sophisticated. A replacement for all three of the other formats, |
| 345 |
it can represent matrices of general data including but not limited to |
| 346 |
black and white, grayscale, and color images. |
| 347 |
.PP |
| 348 |
Programs designed to work with PBM images have "pbm" in their names. |
| 349 |
Programs designed to work with PGM, PPM, and PAM images similarly have |
| 350 |
"pgm", "ppm", and "pam" in their names. |
| 351 |
.PP |
| 352 |
All Netpbm programs designed to read PGM images see PBM images as if |
| 353 |
they were PGM too. All Netpbm programs designed to read PPM images |
| 354 |
see PGM and PBM images as if they were PPM. See |
| 355 |
.UR #impconv |
| 356 |
Implied Format Conversion |
| 357 |
.UE |
| 358 |
\&. |
| 359 |
.PP |
| 360 |
Programs that have "pnm" in their names read PBM, PGM, |
| 361 |
and PPM but unlike "ppm" programs, they distinguish between |
| 362 |
those formats and their function depends on the format. For example, |
| 363 |
.BR "pnmtopng" (1)\c |
| 364 |
\& creates a black and white PNG |
| 365 |
output image if its input is PBM or PGM, but a color PNG output image |
| 366 |
if its input is PPM. And \fBpnmrotate\fP produces an output image of |
| 367 |
the same format as the input. A hypothetical \fBppmrotate\fP program |
| 368 |
would also read all three PNM input formats, but would see them all as |
| 369 |
PPM and would always generate PPM output. |
| 370 |
.PP |
| 371 |
Programs that have "pam" in their names read all the Netpbm |
| 372 |
formats: PBM, PGM, PPM, and PAM. They sometimes treat them all as if |
| 373 |
they are PAM, using an implied conversion, but often they recognize |
| 374 |
the individual formats and behave accordingly, like a "pnm" program |
| 375 |
does. See |
| 376 |
.UR #impconv |
| 377 |
Implied Format Conversion |
| 378 |
.UE |
| 379 |
\&. |
| 380 |
.PP |
| 381 |
Finally, there are subformats of PAM that are equivalent to PBM, |
| 382 |
PGM, and PPM respectively, and Netpbm programs designed to read |
| 383 |
PBM, PGM, and/or PPM see those PAM images as if they were the former. |
| 384 |
For example, \fBppmhist\fP can analyze a PAM image of tuple type |
| 385 |
RGB (i.e. a color image) as if it were PPM. |
| 386 |
.PP |
| 387 |
If it seems wasteful to you to have three separate PNM formats, be |
| 388 |
aware that there is a historical reason for it. In the beginning, |
| 389 |
there were only PBMs. PGMs came later, and then PPMs. Much later |
| 390 |
came PAM, which realizes the possibility of having just one aggregate |
| 391 |
format. |
| 392 |
.PP |
| 393 |
The formats are described in the specifications of |
| 394 |
.BR "pbm" (1)\c |
| 395 |
\&, |
| 396 |
.BR "pgm" (1)\c |
| 397 |
\&, |
| 398 |
.BR "ppm" (1)\c |
| 399 |
\&, |
| 400 |
and |
| 401 |
.BR "pam" (1)\c |
| 402 |
\&. |
| 403 |
|
| 404 |
.UN impconv |
| 405 |
.SS Implied Format Conversion |
| 406 |
.PP |
| 407 |
A program that uses the PGM library subroutines to read an image |
| 408 |
can read a PBM image as well as a PGM image. The program sees the PBM |
| 409 |
image as if it were the equivalent PGM image, with a maxval of 255. |
| 410 |
\fBnote:\fP This sometimes confuses people who are looking |
| 411 |
at the formats at a lower layer than they ought to be because a zero |
| 412 |
value in a PBM raster means white, while a zero value in a PGM raster |
| 413 |
means black. |
| 414 |
.PP |
| 415 |
A program that uses the PPM library subroutines to read an image |
| 416 |
can read a PGM image as well as a PPM image and a PBM image as well as |
| 417 |
a PGM image. The program sees the PBM or PGM image as if it were the |
| 418 |
equivalent PPM image, with a maxval of 255 in the PBM case and the |
| 419 |
same maxval as the PGM in the PGM case. |
| 420 |
.PP |
| 421 |
A program that uses the PAM library subroutines to read an image |
| 422 |
can read a PBM, PGM, or PPM image as well as a PAM image. The program |
| 423 |
sees a PBM image as if it were the equivalent PAM image with tuple |
| 424 |
type \fBBLACKANDWHITE\fP. It sees a PGM image as if it were the |
| 425 |
equivalent PAM image with tuple type \fBGRAYSCALE\fP. It sees a PPM |
| 426 |
image as if it were the equivalent PAM image with tuple type |
| 427 |
\fBRGB\fP. But the program actually can see deeper if it wants to. |
| 428 |
It can tell exactly which format the input was and may respond |
| 429 |
accordingly. For example, a PAM program typically produces output in |
| 430 |
the same format as its input. |
| 431 |
.PP |
| 432 |
A program that uses the PGM library subroutines to read an image |
| 433 |
can read a PAM image as well a PGM image, if the PAM is a grayscale or |
| 434 |
black and white visual image. That canonically means the PAM has a |
| 435 |
depth of 1 and a tuple type of GRAYSCALE or BLACKANDWHITE, but |
| 436 |
most Netpbm programs are fairly liberal and will take any PAM at all, |
| 437 |
ignoring all but the first plane. |
| 438 |
.PP |
| 439 |
There is a similar implied conversion for PPM library subroutines |
| 440 |
reading PAM. There is nothing similar for PBM, so if you need for a |
| 441 |
PBM program to read a PAM image, run it through \fBpamtopnm\fP. |
| 442 |
|
| 443 |
|
| 444 |
.UN transparency |
| 445 |
.SS Netpbm and Transparency |
| 446 |
.PP |
| 447 |
In many graphics formats, there's a means of indicating that certain |
| 448 |
parts of the image are wholly or partially transparent, meaning that |
| 449 |
if it were displayed "over" another image, the other image |
| 450 |
would show through there. Netpbm formats deliberately omit that |
| 451 |
capability, since their purpose is to be extremely simple. |
| 452 |
.PP |
| 453 |
In Netpbm, you handle transparency via a transparency mask in a |
| 454 |
separate (slightly redefined) PGM image. In this pseudo-PGM, what |
| 455 |
would normally be a pixel's intensity is instead an opaqueness value. |
| 456 |
See |
| 457 |
.BR "pgm" (1)\c |
| 458 |
\&. |
| 459 |
.BR "pamcomp" (1)\c |
| 460 |
\& is an example of a program that uses |
| 461 |
a PGM transparency mask. |
| 462 |
.PP |
| 463 |
Another means of representing transparency information has recently |
| 464 |
developed in Netpbm, using PAM images. In spite of the argument given |
| 465 |
above that Netpbm formats should be too simple to have transparency |
| 466 |
information built in, it turns out to be extremely inconvenient to |
| 467 |
have to carry the transparency information around separately. This is |
| 468 |
primarily because Unix shells don't provide easy ways to have networks |
| 469 |
of pipelines. You get one input and one output from each program in a |
| 470 |
pipeline. So you'd like to have both the color information and the |
| 471 |
transparency information for an image in the same pipe at the same |
| 472 |
time. |
| 473 |
.PP |
| 474 |
For that reason, some new (and recently renovated) Netpbm programs |
| 475 |
recognize and generate a PAM image with tuple type RGB_ALPHA or |
| 476 |
GRAYSCALE_ALPHA, which contains a plane for the transparency |
| 477 |
information. See |
| 478 |
.BR "the PAM specification" (1)\c |
| 479 |
\&. |
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
.UN libnetpbm |
| 485 |
.SH The Netpbm Library |
| 486 |
.PP |
| 487 |
The Netpbm programming library, |
| 488 |
.BR "libnetpbm" (1)\c |
| 489 |
\&, makes it easy to write programs |
| 490 |
that manipulate graphic images. Its main function is to read and |
| 491 |
write files in the Netpbm formats, and because the Netpbm package |
| 492 |
contains converters for all the popular graphics formats, if your |
| 493 |
program reads and writes the Netpbm formats, you can use it with any |
| 494 |
formats. |
| 495 |
.PP |
| 496 |
But the library also contain some utility functions, such as character |
| 497 |
drawing and RGB/YCrCb conversion. |
| 498 |
.PP |
| 499 |
The library has the conventional C linkage. Virtually all programs |
| 500 |
in the Netpbm package are based on the Netpbm library. |
| 501 |
|
| 502 |
|
| 503 |
.UN config |
| 504 |
.SH netpbm-config |
| 505 |
.PP |
| 506 |
In a standard installation of Netpbm, there is a program named |
| 507 |
\fBnetpbm-config\fP in the regular program search path. We don't |
| 508 |
consider this a Netpbm program -- it's just an ancillary part of a |
| 509 |
Netpbm installation. This program tells you information about the |
| 510 |
Netpbm installation, and is intended to be run by other programs that |
| 511 |
interface with Netpbm. In fact, \fBnetpbm-config\fP is really a |
| 512 |
configuration file, like those you typically see in the \fI/etc/\fP |
| 513 |
directory of a Unix system. |
| 514 |
.PP |
| 515 |
Example: |
| 516 |
.nf |
| 517 |
$netpbm-config --datadir |
| 518 |
/usr/local/netpbm/data |
| 519 |
|
| 520 |
.fi |
| 521 |
|
| 522 |
If you write a program that needs to access a Netpbm data file, it can |
| 523 |
use such a shell command to find out where the Netpbm data files are. |
| 524 |
.PP |
| 525 |
\fBnetpbm-config\fP is the only file that must be installed in |
| 526 |
a standard directory (it must be in a directory that is in the default |
| 527 |
program search path). You can use \fBnetpbm-config\fP as a bootstrap |
| 528 |
to find all the other Netpbm files. |
| 529 |
.PP |
| 530 |
There is no detailed documentation of \fBnetpbm-config\fP. If you're |
| 531 |
in a position to use it, you should have no trouble reading the file |
| 532 |
itself to figure out how to use it. |
| 533 |
|
| 534 |
.UN memoryusage |
| 535 |
.SH Memory Usage |
| 536 |
.PP |
| 537 |
An important characteristic that varies among graphics software is |
| 538 |
how much memory it uses, and how. Does it read an entire image into |
| 539 |
memory, work on it there, then write it out all at once? Does it read one |
| 540 |
and write one pixel at a time? In Netpbm, it differs from one program |
| 541 |
to the next, but there are some generalizations we can make. |
| 542 |
.PP |
| 543 |
Most Netpbm programs keep one row of pixels at a time in memory. |
| 544 |
Such a program reads a row from an input file, processes it, then |
| 545 |
writes a row to an output file. Some programs execute algorithms that |
| 546 |
can't work like that, so they keep a small window of rows in memory. |
| 547 |
Others must keep the entire image in memory. If you think of what job |
| 548 |
the program does, you can probably guess which one it does. |
| 549 |
.PP |
| 550 |
When Netpbm keeps a pixel in memory, it normally uses a lot more |
| 551 |
space for it than it occupies in the Netpbm image file format. |
| 552 |
.PP |
| 553 |
The older programs (most of Netpbm) use 12 bytes per pixel. This |
| 554 |
is true even for a PBM image, for which it only really takes one bit |
| 555 |
to totally describe the pixel. Netpbm does this expansion to make |
| 556 |
implementing the programs easier -- it uses the same format regardless |
| 557 |
of the type of image. |
| 558 |
.PP |
| 559 |
Newer programs use the "pam" family of library functions |
| 560 |
internally, which use memory a little differently. These functions are |
| 561 |
designed to handle generic tuples with a variable numbers of planes, so no |
| 562 |
fixed size per-tuple storage is possible. A program of this type uses 4 bytes |
| 563 |
per sample (a tuple is composed of samples), plus a pointer (4-8 bytes) per |
| 564 |
tuple. In a graphic image, a tuple is a pixel. So an ordinary color image |
| 565 |
takes 16-20 bytes per pixel. |
| 566 |
.PP |
| 567 |
When considering memory usage, it is important to remember that |
| 568 |
memory and disk storage are equivalent in two ways: |
| 569 |
|
| 570 |
|
| 571 |
.IP \(bu |
| 572 |
Memory is often virtual, backed by swap space on disk storage. So |
| 573 |
accessing memory may mean doing disk I/O. |
| 574 |
|
| 575 |
.IP \(bu |
| 576 |
Files are usually cached and buffered, so that accessing a disk file |
| 577 |
may just mean accessing memory. |
| 578 |
|
| 579 |
.PP |
| 580 |
This means that the consequences of whether a program works from |
| 581 |
the image file or from a memory copy are not straightforward. |
| 582 |
.PP |
| 583 |
Note that an image takes a lot less space in a Netpbm format file, |
| 584 |
and therefore in an operating system's file cache, than in Netpbm's |
| 585 |
in-memory format. In non-Netpbm image formats, the data is even |
| 586 |
smaller. So reading through an input file multiple times instead of |
| 587 |
keeping a copy in regular memory can be the best use of memory, and many |
| 588 |
Netpbm programs do that. But some files can't be read multiple times. |
| 589 |
In particular, you can't rewind and re-read a pipe, and a pipe is |
| 590 |
often the input for a Netpbm program. Netpbm programs that re-read |
| 591 |
files detect such input files and read them into a temporary file, |
| 592 |
then read that temporary file multiple times. |
| 593 |
.PP |
| 594 |
A few Netpbm programs use an in-memory format that is just one bit |
| 595 |
per pixel. These are programs that convert between PBM and a format that |
| 596 |
has a raster format very much like PBM's. In this case, it would actually |
| 597 |
make the program more complicated (in addition to much slower) to use |
| 598 |
Netpbm's generic 12 byte or 8 byte pixel representation. |
| 599 |
.PP |
| 600 |
By the way, the old axiom that memory is way faster than disk is not |
| 601 |
necessarily true. On small systems, it typically is true, but on a |
| 602 |
system with a large network of disks, especially with striping, it is |
| 603 |
quite easy for the disk storage to be capable of supplying data faster |
| 604 |
than the CPU can use it. |
| 605 |
|
| 606 |
.UN cpuusage |
| 607 |
.SH CPU Usage |
| 608 |
.PP |
| 609 |
People sometimes wonder what CPU facilities Netpbm programs and the |
| 610 |
Netpbm programming library use. The programs never depend on particular |
| 611 |
features existing (assuming they're compiled properly), but the speed |
| 612 |
and cost of running a program varies depending upon the CPU features. |
| 613 |
.PP |
| 614 |
Note that when you download a binary that someone else compiled, even |
| 615 |
though it appears to be compiled properly for your machine, it may be compiled |
| 616 |
improperly for that machine if it is old, because the person who compiled it |
| 617 |
may have chosen to exploit features of newer CPUs in the line. For example, |
| 618 |
an x86 program may be compiled to use instructions that are present on an |
| 619 |
80486, but not on an 80386. You would probably not know this until you run |
| 620 |
the program and it crashes. |
| 621 |
.PP |
| 622 |
But the default build options almost always build binaries that are as |
| 623 |
backward compatible with old CPUs as possible. An exception is a build for a |
| 624 |
64 bit x86 CPU. While the builder could build a program that runs on a 32 bit |
| 625 |
x86, it does not do so by default. A default build builds a program will not |
| 626 |
run on an older 32-bit-only x86 CPU. |
| 627 |
.PP |
| 628 |
One common build option is to use MMX/SSE operands with x86 CPUs. |
| 629 |
Those are not available on older x86 CPUs. The builder by default does not |
| 630 |
generate code that uses MMX/SSE when building for 32 bit x86 CPUs, but |
| 631 |
does when building for 64 bit x86. |
| 632 |
.PP |
| 633 |
One area of particular importance is floating point arithmetic. |
| 634 |
The Netpbm image formats are based on integers, and Netpbm arithmetic |
| 635 |
is done with integers where possible. But there is one significant |
| 636 |
area that is floating point: programs that must deal with light |
| 637 |
intensity. The Netpbm formats use integers that are proportional to |
| 638 |
brightness, and brightness is exponentially related to light |
| 639 |
intensity. The programs have to keep the intermediate intensity |
| 640 |
values in floating point in order not to lose precision. And the |
| 641 |
conversion (gamma function) between the two is heavy-duty floating |
| 642 |
point arithmetic. |
| 643 |
|
| 644 |
Programs that mix pixels together have to combine light intensity, so |
| 645 |
they do heavy floating point. Three of the most popular Netpbm |
| 646 |
programs do that: |
| 647 |
.BR "\fBpamscale\fP" (1)\c |
| 648 |
\& |
| 649 |
(shrink/expand an image), |
| 650 |
.BR "\fBpamcomp\fP" (1)\c |
| 651 |
\& |
| 652 |
(overlay an image over another one), and |
| 653 |
.BR "\fBpamditherbw\fP" (1)\c |
| 654 |
\& (Make a black and white |
| 655 |
image that approximates a grayscale image). |
| 656 |
.PP |
| 657 |
The Netpbm image formats use 16 bit integers. The Netpbm code uses |
| 658 |
"unsigned int" size integers to work with them. |
| 659 |
|
| 660 |
|
| 661 |
.UN netpbmforgimp |
| 662 |
.SH Netpbm For Gimp |
| 663 |
.PP |
| 664 |
The Gimp is a visual image editor for Unix and X, so it does the kinds |
| 665 |
of things that Netpbm does, but interactively in a user-friendly way. |
| 666 |
The Gimp knows a variety of graphics file formats and image transformations, |
| 667 |
but you can extend it with plugins. |
| 668 |
.PP |
| 669 |
A particularly easy way to write a Gimp plugin is to write a Netpbm program |
| 670 |
(remember that a fundamental mission of Netpbm is make writing image |
| 671 |
manipulation programs easy) and then use \fB |
| 672 |
.UR http://netpbm2gimp.sourceforge.net/ |
| 673 |
netpbm2gimp |
| 674 |
.UE |
| 675 |
\&\fP to compile |
| 676 |
that same source code into a Gimp plugin. |
| 677 |
.PP |
| 678 |
You can turn a program that converts from a certain graphics file format |
| 679 |
to Netpbm format into a Gimp \fIload\fP plugin. Likewise, you |
| 680 |
can turn a program that converts \fIto\fP a certain graphics format |
| 681 |
\fIfrom\fP Netpbm format into a Gimp \fIstore\fP plugin. Finally, |
| 682 |
a program that transforms images in Netpbm format can become a |
| 683 |
\fIprocess\fP plugin. |
| 684 |
.PP |
| 685 |
And the \fBnetpbm2gimp\fP project has already packaged for you a few |
| 686 |
hundred of the Netpbm programs as Gimp plugins. With this package you can, |
| 687 |
for example, edit an image in any of the arcane graphics file formats that |
| 688 |
Netpbm understands but no other image editor in existence does. |
| 689 |
|
| 690 |
|
| 691 |
.UN companion |
| 692 |
.SH Companion Software |
| 693 |
|
| 694 |
.UN phpnetpbm |
| 695 |
.SS PHP-NetPBM |
| 696 |
.PP |
| 697 |
If you're using Netpbm to do graphics for a website, you can invoke |
| 698 |
the Netpbm programs from a PHP script. To make this even easier, |
| 699 |
check out |
| 700 |
.UR http://sourceforge.net/projects/phpnetpbm |
| 701 |
PHP-NetPBM |
| 702 |
.UE |
| 703 |
\&, |
| 704 |
a PHP class that interacts with Netpbm. Its main goal is to decrease the |
| 705 |
pain of using Netpbm when working with images in various formats. It |
| 706 |
includes macro commands to perform manipulations on many files. |
| 707 |
.PP |
| 708 |
I can't actually recommend PHP-NetPBM. I spent some time staring |
| 709 |
at it and was unable to make sense of it. Some documentation is in |
| 710 |
fractured English and other is in an unusual character set. But a PHP |
| 711 |
expert might be able to figure it out and get some use out of it. |
| 712 |
|
| 713 |
.UN othersoftware |
| 714 |
.SH Other Graphics Software |
| 715 |
.PP |
| 716 |
Netpbm contains primitive building blocks. It certainly is not a |
| 717 |
complete graphics software library. |
| 718 |
|
| 719 |
.UN othercmdline |
| 720 |
.SS Command Line Programs |
| 721 |
.PP |
| 722 |
\fBImageMagick\fP does many of the same things - mainly the more |
| 723 |
popular ones - that Netpbm does, including conversion between popular |
| 724 |
formats and basic editing. \fBconvert\fP, \fBmogrify\fP, \fBmontage\fP, and |
| 725 |
\fBanimate\fP are popular programs from the \fBImageMagick\fP |
| 726 |
package. \fBImageMagick\fP runs on Unix, Windows, Windows NT, Macintosh, and |
| 727 |
VMS. |
| 728 |
.PP |
| 729 |
\fBImageMagick\fP also contains the program \fBdisplay\fP, which is a |
| 730 |
.UR #viewers |
| 731 |
viewer |
| 732 |
.UE |
| 733 |
\& and |
| 734 |
.UR #visual |
| 735 |
visual editor |
| 736 |
.UE |
| 737 |
\&. |
| 738 |
|
| 739 |
.UN viewers |
| 740 |
.SS Image Viewers |
| 741 |
.PP |
| 742 |
The first thing you will want to make use of any of these tools is a |
| 743 |
viewer. (On GNU/Linux, you can use Netpbm's \fBpamx\fP or \fBppmsvgalib\fP |
| 744 |
in a pinch, but it is pretty limiting). \fBzgv\fP is a good full service |
| 745 |
viewer to use on a GNU/Linux system with the SVGALIB graphics display driver |
| 746 |
library. You can find \fBzgv\fP |
| 747 |
at \fB |
| 748 |
.UR ftp://ftp.ibiblio.org/pub/Linux/apps/graphics/viewers/svga |
| 749 |
ftp://ftp.ibiblio.org/pub/Linux/apps/graphics/viewers/svga |
| 750 |
.UE |
| 751 |
\&.\fP |
| 752 |
.PP |
| 753 |
\fBzgv\fP even has a feature in it wherein you can visually crop |
| 754 |
an image and write an output file of the cropped image using |
| 755 |
.BR "pamcut" (1)\c |
| 756 |
\&. |
| 757 |
|
| 758 |
See the \fB-s\fP option to \fBzgv\fP. |
| 759 |
.PP |
| 760 |
For the X inclined, there is also \fBxzgv\fP. |
| 761 |
.PP |
| 762 |
\fBxwud\fP (X Window Undump) is a classic application program in the X |
| 763 |
Window System that displays an image in an X window. It takes the special X |
| 764 |
Window Dump format as input; you can use |
| 765 |
Netpbm's |
| 766 |
.BR "\fBpnmtoxwd\fP" (1)\c |
| 767 |
\& to create it. You're |
| 768 |
probably better off just using Netpbm's |
| 769 |
.BR "\fBpamx\fP" (1)\c |
| 770 |
\&. |
| 771 |
.PP |
| 772 |
\fBxloadimage\fP and its extension \fBxli\fP are also common |
| 773 |
ways to display a graphic image in X. |
| 774 |
.PP |
| 775 |
\fBgqview\fP is a more modern X-based image viewer. |
| 776 |
.PP |
| 777 |
\fBqiv\fP is a small, very fast viewer for X. |
| 778 |
.PP |
| 779 |
To play mpeg movies, such as produced by \fBppmtompeg\fP, |
| 780 |
try |
| 781 |
.BR "mplayer" (1)\c |
| 782 |
\& or |
| 783 |
\fB |
| 784 |
.UR http://sourceforge.net/projects/xine |
| 785 |
xine |
| 786 |
.UE |
| 787 |
\&.\fP |
| 788 |
.PP |
| 789 |
See \fB |
| 790 |
.UR ftp://metalab.unc.edu/pub/Linux/apps/graphics/viewers/X |
| 791 |
ftp://metalab.unc.edu/pub/Linux/apps/graphics/viewers/X |
| 792 |
.UE |
| 793 |
\&\fP. |
| 794 |
|
| 795 |
.UN capturers |
| 796 |
.SS Image Capturers |
| 797 |
.PP |
| 798 |
\fBxwd\fP (X Window Dump), a classic application program in the X Window |
| 799 |
System, captures the contents of an X window, in its own special image format, |
| 800 |
called X Window Dump File. You can use |
| 801 |
Netpbm's |
| 802 |
.BR "\fBxwdtopnm\fP" (1)\c |
| 803 |
\& to turn it into something |
| 804 |
more useful. |
| 805 |
.PP |
| 806 |
.UR http://www.rcdrummond.net/fbdump/ |
| 807 |
\fBfbdump\fP |
| 808 |
.UE |
| 809 |
\& |
| 810 |
Capturers the current contents of a video display on the local computer |
| 811 |
and generates a PPM image of it. It works with Linux framebuffer devices. |
| 812 |
|
| 813 |
|
| 814 |
.UN visual |
| 815 |
.SS Visual Graphics Software |
| 816 |
.PP |
| 817 |
Visual graphics software is modern point-and-click software that |
| 818 |
displays an image and lets you work on it and see the results as you go. |
| 819 |
This is fundamentally different from what Netpbm programs do. |
| 820 |
.PP |
| 821 |
\fBxv\fP is a very old and very popular simple image editor in the |
| 822 |
Unix world. It does not have much in the way of current support, |
| 823 |
or maintenance, though. |
| 824 |
.PP |
| 825 |
Gimp is a visual image editor for Unix and the X Window System, in the same |
| 826 |
category as the more famous, less capable, and much more expensive Adobe |
| 827 |
Photoshop, etc. for Windows. |
| 828 |
See \fB |
| 829 |
.UR http://www.gimp.org |
| 830 |
http://www.gimp.org |
| 831 |
.UE |
| 832 |
\&\fP. And you can |
| 833 |
add most of Netpbm's function to Gimp |
| 834 |
using |
| 835 |
.UR http://netpbm2gimp.sourceforge.net/ |
| 836 |
Netpbm2gimp |
| 837 |
.UE |
| 838 |
\&. |
| 839 |
.PP |
| 840 |
\fBImageMagick\fP contains the program \fBdisplay\fP, which is another |
| 841 |
visual image editor. It has fewer functions than Gimp. This program uses the |
| 842 |
X Window System. The package also contains |
| 843 |
.UR #othercmdline |
| 844 |
command line |
| 845 |
.UE |
| 846 |
\& graphics programs. |
| 847 |
.PP |
| 848 |
Electric Eyes, \fBkuickshow\fP, and \fBgthumb\fP are also visual |
| 849 |
editors for the X/Window system, and \fBKView\fP and \fBgwenview\fP |
| 850 |
are specifically for KDE. |
| 851 |
|
| 852 |
.UN programmingtools |
| 853 |
.SS Programming Tools |
| 854 |
.PP |
| 855 |
If you're writing a program in C to draw and manipulate images, check out |
| 856 |
.UR https://github.com/libgd/libgd |
| 857 |
gd |
| 858 |
.UE |
| 859 |
\&. Netpbm contains a C library |
| 860 |
for drawing images (\fBlibnetpbm\fP's "ppmd" routines), but it is |
| 861 |
not as capable or documented as \fBgd\fP. There are wrapper libraries |
| 862 |
available for Perl, PHP, and other language. |
| 863 |
.PP |
| 864 |
You can easily run any Netpbm program from a C program with |
| 865 |
the \fBpm_system\fP function from the Netpbm programming library, but that is |
| 866 |
less efficient than \fBgd\fP functions that do the same thing. |
| 867 |
.PP |
| 868 |
.UR http://cairographics.org/ |
| 869 |
Cairo |
| 870 |
.UE |
| 871 |
\& is similar. |
| 872 |
.PP |
| 873 |
\fBIlib\fP is a C subroutine library with functions for adding |
| 874 |
text to an image (as you might do at a higher level with |
| 875 |
\fBpbmtext\fP, \fBpamcomp\fP, etc.). It works with Netpbm input and |
| 876 |
output. Find it at \fB |
| 877 |
.UR http://www.k5n.us/Ilib.php |
| 878 |
k5n.us |
| 879 |
.UE |
| 880 |
\&\fP. |
| 881 |
Netpbm also includes character drawing functions in the |
| 882 |
.BR "libnetpbm" (1)\c |
| 883 |
\& library, but they do not have as |
| 884 |
fancy font capabilities (see |
| 885 |
.BR "ppmdraw" (1)\c |
| 886 |
\& |
| 887 |
for an example of use of the Netpbm character drawing functions). |
| 888 |
.PP |
| 889 |
.UR http://www.pango.org/ |
| 890 |
Pango |
| 891 |
.UE |
| 892 |
\& is another text rendering |
| 893 |
library, with an emphasis on internationalization. |
| 894 |
.PP |
| 895 |
Pango and Cairo complement each other and work well together. |
| 896 |
.PP |
| 897 |
\fBGD\fP is a library of graphics routines that is part of PHP. |
| 898 |
It has a subset of Netpbm's functions and has been found to resize |
| 899 |
images more slowly and with less quality. |
| 900 |
|
| 901 |
.UN toolsforformats |
| 902 |
.SS Tools For Specific Graphics Formats |
| 903 |
.PP |
| 904 |
\fBmencode\fP, which is part of the |
| 905 |
.BR "mplayer" (1)\c |
| 906 |
\& package, |
| 907 |
creates movie files. It's like a much more advanced version of |
| 908 |
.BR "\fBppmtompeg\fP" (1)\c |
| 909 |
\&, without the Netpbm |
| 910 |
building block simplicity. |
| 911 |
.PP |
| 912 |
.UR http://mjpeg.sourceforge.net |
| 913 |
\fBMJPEGTools\fP |
| 914 |
.UE |
| 915 |
\& is software |
| 916 |
for dealing with the MJPEG movie format. |
| 917 |
.PP |
| 918 |
To create an animated GIF, or extract a frame from one, use |
| 919 |
\fBgifsicle\fP. \fBgifsicle\fP converts between animated GIF and |
| 920 |
still GIF, and you can use \fBpamtogif\fP and \fBgiftopnm\fP to |
| 921 |
connect up to all the Netpbm utilities. See \fB |
| 922 |
.UR http://www.lcdf.org/gifsicle |
| 923 |
http://www.lcdf.org/gifsicle |
| 924 |
.UE |
| 925 |
\&\fP. |
| 926 |
.PP |
| 927 |
To convert an image of text to text (optical character recognition |
| 928 |
- OCR), use \fBgocr\fP (think of it as an inverse of \fBpbmtext\fP). |
| 929 |
See \fB |
| 930 |
.UR http://jocr.sourceforge.net/ |
| 931 |
http://jocr.sourceforge.net/ |
| 932 |
.UE |
| 933 |
\&\fP. |
| 934 |
.PP |
| 935 |
\fB |
| 936 |
.UR http://schaik.com/pngsuite |
| 937 |
http://schaik.com/pngsuite |
| 938 |
.UE |
| 939 |
\&\fP |
| 940 |
contains a PNG test suite -- a whole bunch of PNG images exploiting the |
| 941 |
various features of the PNG format. |
| 942 |
.PP |
| 943 |
Other versions of Netpbm's \fBpnmtopng\fP/\fBpngtopam\fP are at |
| 944 |
.BR " |
| 945 |
http://www.schaik.com/png/pnmtopng.html" (1)\c |
| 946 |
\&. |
| 947 |
.PP |
| 948 |
The version in Netpbm was actually based on that package a long time |
| 949 |
ago, and you can expect to find better exploitation of the PNG format, |
| 950 |
especially recent enhancements, in that package. It may be a little |
| 951 |
less consistent with the Netpbm project and less exploitive of recent |
| 952 |
Netpbm format enhancements, though. |
| 953 |
.PP |
| 954 |
\fB |
| 955 |
.UR http://pngwriter.sourceforge.net |
| 956 |
pngwriter |
| 957 |
.UE |
| 958 |
\&\fP is a |
| 959 |
C++ library for creating PNG images. With it, you plot an image pixel |
| 960 |
by pixel. You can also render text with the FreeType2 library. |
| 961 |
.PP |
| 962 |
\fBjpegtran\fP Does some of the same transformations as Netpbm is |
| 963 |
famous for, but does them specifically on JPEG files and does them |
| 964 |
without loss of information. By contrast, if you were to use Netpbm, |
| 965 |
you would first decompress the JPEG image to Netpbm format, then |
| 966 |
transform the image, then compress it back to JPEG format. In that |
| 967 |
recompression, you lose a little image information because JPEG is a |
| 968 |
lossy compression. Of course, only a few kinds of lossless |
| 969 |
transformation are possible. \fBjpegtran\fP comes with the |
| 970 |
Independent JPEG Group's ( |
| 971 |
.UR http://www.ijg.org |
| 972 |
http://www.ijg.org) |
| 973 |
.UE |
| 974 |
\& JPEG library. |
| 975 |
.PP |
| 976 |
Some tools to deal with EXIF files (see also Netpbm's |
| 977 |
.BR "jpegtopnm" (1)\c |
| 978 |
\& and |
| 979 |
.BR "pnmtojpeg" (1)\c |
| 980 |
\&): |
| 981 |
|
| 982 |
To dump (interpret) an EXIF header: Exifdump (( |
| 983 |
.UR http://www.math.u-psud.fr/~bousch/exifdump.py |
| 984 |
http://www.math.u-psud.fr/~bousch/exifdump.py) |
| 985 |
.UE |
| 986 |
\&) |
| 987 |
or |
| 988 |
.UR http://www.sentex.net/~mwandel/jhead |
| 989 |
Jhead |
| 990 |
.UE |
| 991 |
\&. |
| 992 |
.PP |
| 993 |
A Python EXIF library and dumper: |
| 994 |
.UR http://pyexif.sourceforge.net. |
| 995 |
http://pyexif.sourceforge.net. |
| 996 |
.UE |
| 997 |
\& |
| 998 |
.PP |
| 999 |
Here's some software to work with IOCA (Image Object Content |
| 1000 |
Architecture): |
| 1001 |
.UR http://www.forminnovation.com |
| 1002 |
ImageToolbox |
| 1003 |
.UE |
| 1004 |
\& ($2500, demo |
| 1005 |
available). This can convert from TIFF -> IOCA and back again. |
| 1006 |
.PP |
| 1007 |
.UR https://ameri-imager.software.informer.com/ |
| 1008 |
Ameri-Imager |
| 1009 |
.UE |
| 1010 |
\& is |
| 1011 |
an image and video editor. ($40 Windows only). |
| 1012 |
.PP |
| 1013 |
\fBpnm2ppa\fP converts to HP's "Winprinter" format (for |
| 1014 |
HP 710, 720, 820, 1000, etc). It is a superset of Netpbm's |
| 1015 |
\fBpbmtoppa \fP and handles, notably, color. However, it is more of |
| 1016 |
a printer driver than a Netpbm-style primitive graphics building |
| 1017 |
block. See |
| 1018 |
.UR http://sourceforge.net/projects/pnm2ppa |
| 1019 |
The Pnm2ppa /Sourceforge Project |
| 1020 |
.UE |
| 1021 |
\& |
| 1022 |
.PP |
| 1023 |
\fBDjVuLibre\fP is a package of software for using the DjVu |
| 1024 |
format. It includes viewers, browser plugins, decoders, simple |
| 1025 |
encoders, and utilities. The encoders and decoders can convert |
| 1026 |
between DjVu and PNM. See |
| 1027 |
.UR http://djvu.sourceforge.net/ |
| 1028 |
the DjVu website. |
| 1029 |
.UE |
| 1030 |
\& |
| 1031 |
|
| 1032 |
|
| 1033 |
.UN document |
| 1034 |
.SS Document/Graphics Software |
| 1035 |
.PP |
| 1036 |
There is a large class of software that does document processing, |
| 1037 |
and that is somewhat related to graphics because documents contain |
| 1038 |
graphics and a page of a document is for many purposes a graphic |
| 1039 |
image. Because of this slight intersection with graphics, I cover |
| 1040 |
document processing software here briefly, but it is for the most part |
| 1041 |
beyond the scope of this document. |
| 1042 |
.PP |
| 1043 |
First, we look at where Netpbm meets document processing. |
| 1044 |
\fBpstopnm\fP converts from Postscript and PDF to PNM. It |
| 1045 |
effectively renders the document into images of printed pages. |
| 1046 |
\fBpstopnm\fP is nothing but a convenient wrapper for |
| 1047 |
.UR http://www.ghostscript.com/ |
| 1048 |
Ghostscript |
| 1049 |
.UE |
| 1050 |
\&, and in particular |
| 1051 |
Netpbm-format device drivers that are part of it. \fBpnmtops\fP and |
| 1052 |
\fBpbmtoepsi\fP convert a PNM image to a Postscript program for |
| 1053 |
printing the image. But to really use PDF and Postscript files, you |
| 1054 |
generally need more complex document processing software. |
| 1055 |
.PP |
| 1056 |
Adobe invented Postscript and PDF and products from Adobe are for many |
| 1057 |
purposes the quintessential Postscript and PDF tools. |
| 1058 |
.PP |
| 1059 |
Adobe's free Acrobat Reader displays PDF and converts to |
| 1060 |
Postscript. The Acrobat Reader for unix has a program name of |
| 1061 |
"acroread" and the -toPostScript option (also see the |
| 1062 |
-level2 option) is useful. |
| 1063 |
.PP |
| 1064 |
Other software from Adobe, available for purchase, interprets and creates |
| 1065 |
Postscript and PDF files. "Distill" is a program that converts Postscript to |
| 1066 |
PDF. |
| 1067 |
.PP |
| 1068 |
.UR http://www.foolabs.com/xpdf/ |
| 1069 |
\fBxpdf\fP |
| 1070 |
.UE |
| 1071 |
\& also reads PDF |
| 1072 |
files. |
| 1073 |
.PP |
| 1074 |
GSview, ghostview, gv, ggv, and kghostview are some other viewers for |
| 1075 |
Postscript and PDF files. |
| 1076 |
.PP |
| 1077 |
The program \fBps2pdf\fP, part of Ghostscript, converts from Postscript |
| 1078 |
to PDF. |
| 1079 |
.PP |
| 1080 |
.BR "bmpp" (1)\c |
| 1081 |
\& converts from |
| 1082 |
Netpbm and other formats to PDF. |
| 1083 |
|
| 1084 |
.PP |
| 1085 |
Two packages that produce more kinds of Encapsulated Postscript |
| 1086 |
than the Netpbm programs, including compressed kinds, are |
| 1087 |
.BR "bmpp" (1)\c |
| 1088 |
\& and |
| 1089 |
.UR http://imgtops.sourceforge.net/ |
| 1090 |
imgtops |
| 1091 |
.UE |
| 1092 |
\&. |
| 1093 |
.PP |
| 1094 |
\fBdvips\fP converts from DVI format to Postscript. DVI is the format |
| 1095 |
that Tex produces. Netpbm can convert from Postscript to PNM. Thus, you |
| 1096 |
can use these in combination to work with Tex/Latex documents graphically. |
| 1097 |
.PP |
| 1098 |
.UR http://wvware.sourceforge.net |
| 1099 |
\fBwvware\fP |
| 1100 |
.UE |
| 1101 |
\& converts |
| 1102 |
a Microsoft Word document (.doc file) to various other formats. While |
| 1103 |
the web page doesn't seem to mention it, it reportedly can extract an |
| 1104 |
embedded image in a Word document as a PNG. |
| 1105 |
.PP |
| 1106 |
.UR http://www.verypdf.com/artprint |
| 1107 |
Document Printer |
| 1108 |
.UE |
| 1109 |
\& |
| 1110 |
converts various print document formats (Microsoft Word, PDF, HTML, etc.) |
| 1111 |
to various graphic image formats. ($38, Windows only). |
| 1112 |
.PP |
| 1113 |
Latex2html converts Latex document source to HTML document source. |
| 1114 |
Part of that involves graphics, and Latex2html uses Netpbm tools for |
| 1115 |
some of that. But Latex2html through its history has had some rather |
| 1116 |
esoteric codependencies with Netpbm. Older Latex2html doesn't work |
| 1117 |
with current Netpbm. Latex2html-99.2beta8 works, though. |
| 1118 |
|
| 1119 |
.UN otherothersoftware |
| 1120 |
.SS Other |
| 1121 |
.PP |
| 1122 |
The \fBfile\fP program looks at a file and tells you what kind of |
| 1123 |
file it is. It recognizes most of the graphics formats with which |
| 1124 |
Netpbm deals, so it is pretty handy for graphics work. Netpbm's |
| 1125 |
.BR "anytopnm" (1)\c |
| 1126 |
\& program depends on \fBfile.\fP |
| 1127 |
See |
| 1128 |
\fB |
| 1129 |
.UR ftp://ftp.astron.com/pub/file |
| 1130 |
ftp://ftp.astron.com/pub/file |
| 1131 |
.UE |
| 1132 |
\&\fP. |
| 1133 |
.PP |
| 1134 |
The Utah Raster Toolkit from the Geometric Design And Computation group in |
| 1135 |
the Department of Computer Science at University of Utah serves a lot of the |
| 1136 |
same purpose as Netpbm, but without the emphasis on format conversions. This |
| 1137 |
package is based on the RLE format, which you can convert to and from the |
| 1138 |
Netpbm formats. |
| 1139 |
.PP |
| 1140 |
\fBIvtools\fP is a suite of free X Window System drawing editors for |
| 1141 |
Postscript, Tex, and web graphics production, as well as an embeddable |
| 1142 |
and extendable vector graphic shell. It uses the Netpbm facilities. |
| 1143 |
See \fB |
| 1144 |
.UR http://www.ivtools.org |
| 1145 |
http://www.ivtools.org |
| 1146 |
.UE |
| 1147 |
\&\fP. |
| 1148 |
.PP |
| 1149 |
Chisato Yamauchi <[email protected]> has written a free |
| 1150 |
c/Fortran graphic library: |
| 1151 |
.UR https://www.ir.isas.jaxa.jp/~cyamauch/eggx_procall/ |
| 1152 |
EGGX/ProCall |
| 1153 |
.UE |
| 1154 |
\&. |
| 1155 |
He says he tried to write the ultimate easy-to-use graphic kit for X. It is |
| 1156 |
for drawing upon an X11 window, but for storage, it outputs PPM. He suggests |
| 1157 |
Netpbm to convert to other formats. |
| 1158 |
.PP |
| 1159 |
The program \fBmorph\fP morphs one image into another. It uses |
| 1160 |
Targa format images, but you can use \fBtgatoppm\fP and |
| 1161 |
\fBppmtotga\fP to deal with that format. You have to use the |
| 1162 |
graphical (X/Tk) Xmorph to create the mesh files that you must feed to |
| 1163 |
\fBmorph\fP. \fBmorph\fP is part of the Xmorph package. See \fB |
| 1164 |
.UR http://xmorph.sourceforge.net/ |
| 1165 |
http://xmorph.sourceforge.net/ |
| 1166 |
.UE |
| 1167 |
\&\fP. |
| 1168 |
|
| 1169 |
|
| 1170 |
.UN otherfmt |
| 1171 |
.SH Other Graphics Formats |
| 1172 |
.PP |
| 1173 |
People never seem to tire of inventing new graphics formats, often |
| 1174 |
completely redundant with pre-existing ones. Netpbm cannot keep up |
| 1175 |
with them. Here is a list of a few that we know Netpbm does |
| 1176 |
\fInot\fP handle (yet). |
| 1177 |
.PP |
| 1178 |
Various commercial Windows software handles dozens of formats that |
| 1179 |
Netpbm does not, especially formats typically used with Windows programs. |
| 1180 |
ImageMagick is probably the most used free image format converter and it |
| 1181 |
also handles lots of formats Netpbm does not. |
| 1182 |
|
| 1183 |
|
| 1184 |
|
| 1185 |
.IP \(bu |
| 1186 |
WebP was announced by Google in October 2010 as a more compressed |
| 1187 |
replacement for JFIF (aka JPEG) on the web. |
| 1188 |
|
| 1189 |
.IP \(bu |
| 1190 |
JPEG-LS is similar to JFIF (aka JPEG) except that it is capable of |
| 1191 |
representing all the information in any raster image, so you could convert |
| 1192 |
from, say, PNM, without losing any information. CharLS is a programming |
| 1193 |
library for JPEG-LS. |
| 1194 |
|
| 1195 |
|
| 1196 |
.IP \(bu |
| 1197 |
Lossless JPEG is a similarly lossless variation of JPEG. It predates |
| 1198 |
every other lossless JPEG variation, but had only brief interest. You can |
| 1199 |
find code for encoding and decoding Lossless JPEG |
| 1200 |
on |
| 1201 |
.UR https://github.com/thorfdbg/libjpeg |
| 1202 |
GitHub |
| 1203 |
.UE |
| 1204 |
\&. |
| 1205 |
|
| 1206 |
.IP \(bu |
| 1207 |
JPEG XR offers greater dynamic range, a wider range of colors, and more |
| 1208 |
efficient compression than JFIF (aka JPEG). Windows and Internet Explorer |
| 1209 |
understand this format, starting with Windows 7 and Internet Explorer 9, along |
| 1210 |
with many other programs. This format was previously known as Windows Media |
| 1211 |
Photo and HD Photo. |
| 1212 |
|
| 1213 |
.IP \(bu |
| 1214 |
Direct Draw Surface (DDS)is the de facto standard wrapper format for S3 |
| 1215 |
texture compression, as used in all modern realtime graphics applications. |
| 1216 |
Besides Windows-based tools, there is a \fBGimp\fP plugin for this format. |
| 1217 |
|
| 1218 |
.IP \(bu |
| 1219 |
DjVu is a web-centric format and software platform for |
| 1220 |
distributing documents and images. Promoters say it is a good |
| 1221 |
replacement for PDF, PS, TIFF, JFIF(JPEG), and GIF for distributing scanned |
| 1222 |
documents, digital documents, or high-resolution pictures, because it |
| 1223 |
downloads faster, displays and renders faster, looks nicer on a |
| 1224 |
screen, and consumes less client resources than competing formats. |
| 1225 |
.sp |
| 1226 |
For more information, see |
| 1227 |
.UR http://djvu.sourceforge.net/ |
| 1228 |
the DjVu website. |
| 1229 |
.UE |
| 1230 |
\& |
| 1231 |
|
| 1232 |
.IP \(bu |
| 1233 |
|
| 1234 |
.UR http://www.web3d.org/x3d/specifications/vrml |
| 1235 |
VRML (Virtual Reality Modelling Language) |
| 1236 |
.UE |
| 1237 |
\& |
| 1238 |
|
| 1239 |
.IP \(bu |
| 1240 |
CALS (originated by US Department Of Defense, favored by architects). |
| 1241 |
It is described in this 1997 listing of graphics formats: |
| 1242 |
.UR http://www.faqs.org/faqs/graphics/fileformats-faq/part3/ |
| 1243 |
http://www.faqs.org/faqs/graphics/fileformats-faq/part3/ |
| 1244 |
.UE |
| 1245 |
\&. CALS |
| 1246 |
has at times been an abbreviation of various things, all of which appear |
| 1247 |
to be essentially the same format, but possibly slightly different: |
| 1248 |
|
| 1249 |
|
| 1250 |
.IP \(bu |
| 1251 |
Computer Aided Logistics Support |
| 1252 |
.IP \(bu |
| 1253 |
Computer Aided Acquisition and Logistics Support |
| 1254 |
.IP \(bu |
| 1255 |
Continuous Acquisition and Life-cycle Support |
| 1256 |
.IP \(bu |
| 1257 |
Commerce At Light Speed |
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
The US Navy publishes |
| 1262 |
.UR https://www.navsea.navy.mil/Home/Warfare-Centers/NSWC-Carderock/Resources/Technical-Information-Systems/IETMs/Specifications-Standards/CALS-Standards/ |
| 1263 |
specs |
| 1264 |
.UE |
| 1265 |
\& |
| 1266 |
for it. |
| 1267 |
|
| 1268 |
.IP \(bu |
| 1269 |
array formats dx, general, netcdf, CDF, hdf, cm |
| 1270 |
.IP \(bu |
| 1271 |
CGM+ |
| 1272 |
|
| 1273 |
.IP \(bu |
| 1274 |
HDR formats OpenEXR, SGI TIFF LogLuv, floating point TIFF, |
| 1275 |
Radiance RGBE |
| 1276 |
|
| 1277 |
.IP \(bu |
| 1278 |
Windows Meta File (.WMF). Libwmf converts from WMF to things like |
| 1279 |
Latex, PDF, PNG. Some of these can be input to Netpbm. |
| 1280 |
|
| 1281 |
.IP \(bu |
| 1282 |
Microsoft Word .doc format. Microsoft keeps a proprietary hold on |
| 1283 |
this format. Any software you see that can handle it is likely to |
| 1284 |
cost money. |
| 1285 |
|
| 1286 |
.IP \(bu |
| 1287 |
RTF |
| 1288 |
|
| 1289 |
.IP \(bu |
| 1290 |
DXF (AutoCAD) |
| 1291 |
.IP \(bu |
| 1292 |
IOCA (Image Object Content Architecture) |
| 1293 |
The specification of this format is documented by IBM: |
| 1294 |
.UR http://publibz.boulder.ibm.com/epubs/pdf/c3168055.pdf |
| 1295 |
Data Stream and Object Architectures: Image Object Content Architecture Reference |
| 1296 |
.UE |
| 1297 |
\&. See above for software that processes this format. |
| 1298 |
|
| 1299 |
.IP \(bu |
| 1300 |
OpenEXR is an HDR format (like |
| 1301 |
.BR "PFM" (1)\c |
| 1302 |
\&). |
| 1303 |
See |
| 1304 |
.UR http://www.openexr.com |
| 1305 |
http://www.openexr.com |
| 1306 |
.UE |
| 1307 |
\&. |
| 1308 |
|
| 1309 |
.IP \(bu |
| 1310 |
Xv Visual Schnauzer thumbnail image. This is a rather antiquated |
| 1311 |
format used by the Xv program. In Netpbm circles, it is best known |
| 1312 |
for the fact that it is very similar to Netpbm formats and uses the |
| 1313 |
same signature ("P7") as PAM because it was developed as |
| 1314 |
sort of a fork of the Netpbm format specifications. |
| 1315 |
|
| 1316 |
.IP \(bu |
| 1317 |
YUV 4:2:0, aka YUV 420, and the similar YUV 4:4:4, YUV 4:2:2, |
| 1318 |
YUV 4:1:1, YUV 4:1:1s, and YUV 4:1:0. Video systems often use this. |
| 1319 |
|
| 1320 |
.IP \(bu |
| 1321 |
.UR http://en.wikipedia.org/wiki/MJPEG |
| 1322 |
MJPEG |
| 1323 |
.UE |
| 1324 |
\& movie |
| 1325 |
format. |
| 1326 |
|
| 1327 |
.IP \(bu |
| 1328 |
YUV4MPEG2 is a movie format whose purpose is similar to that of |
| 1329 |
the Netpbm formats for still images. You use it for manipulating |
| 1330 |
movies, but not for storing or transmitting them. The only known use |
| 1331 |
of the format is with |
| 1332 |
.UR http://mjpeg.sourceforge.net |
| 1333 |
\fBMJPEGTools\fP |
| 1334 |
.UE |
| 1335 |
\&. The programs |
| 1336 |
\fBpnmtoy4m\fP and \fBy4mtopnm\fP (and predecessors \fBppmtoy4m\fP |
| 1337 |
and \fBy4mtoppm\fP) in that package convert between a Netpbm stream |
| 1338 |
and a YUV4MPEG2 stream. As you might guess from the name, YUV4MPEG2 |
| 1339 |
uses a YUV representation of data, which is more convenient than the |
| 1340 |
Netpbm formats' RGB representation for working with data that is |
| 1341 |
ultimately MPEG2. |
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
.UN history |
| 1346 |
.SH History |
| 1347 |
.PP |
| 1348 |
Netpbm has a long history, starting with Jef Poskanzer's Pbmplus |
| 1349 |
package in 1988. See the |
| 1350 |
.BR "Netpbm web site" (1)\c |
| 1351 |
\& |
| 1352 |
for details. |
| 1353 |
.PP |
| 1354 |
The file \fBdoc/HISTORY\fP in the Netpbm source code contains a |
| 1355 |
detailed change history release by release. |
| 1356 |
|
| 1357 |
|
| 1358 |
.UN author |
| 1359 |
.SH Author |
| 1360 |
.PP |
| 1361 |
Netpbm is based on the Pbmplus package by Jef Poskanzer, first |
| 1362 |
distributed in 1988 and maintained by him until 1991. But the package |
| 1363 |
contains work by countless other authors, added since Jef's original |
| 1364 |
work. In fact, the name is derived from the fact that the work was |
| 1365 |
contributed by people all over the world via the Internet, when such |
| 1366 |
collaboration was still novel enough to merit naming the package after |
| 1367 |
it. |
| 1368 |
.PP |
| 1369 |
Bryan Henderson has been maintaining Netpbm since 1999. In |
| 1370 |
addition to packaging work by others, Bryan has also written a |
| 1371 |
significant amount of new material for the package. |
| 1372 |
.SH DOCUMENT SOURCE |
| 1373 |
This manual page was generated by the Netpbm tool 'makeman' from HTML |
| 1374 |
source. The master documentation is at |
| 1375 |
.IP |
| 1376 |
.B http://netpbm.sourceforge.net/doc/index.html |
| 1377 |
.PP |