Convert a Bennet Yee Face File to PBM with ybmtopbm

ybmtopbm turns an old Bennet Yee face file into a portable bitmap without touching the original. You will convert one, then confirm the output has the dimensions you expected. The examples use ybmtopbm from Netpbm package version 2:11.05.02-1.1build1, installed at /usr/bin/ybmtopbm.

Allow about ten minutes. You need a shell, the Netpbm package, and a face file produced for the Bennet Yee face or xbm programs. The converter reads one input and writes one PBM image; it needs elevated privileges only if your input or output directory is not readable or writable by your own account.

1. Check the installed command

Confirm which executable and package version you are about to use:

$ command -v ybmtopbm
/usr/bin/ybmtopbm
$ dpkg-query -W -f='${Package} ${Version}\n' netpbm
netpbm 2:11.05.02-1.1build1

The installed manual gives this syntax:

ybmtopbm [facefile]

The bracketed argument is optional because Netpbm converters commonly accept standard input when no filename is supplied. For a first conversion, name the input explicitly anyway: it keeps the source visible in the command and makes it much harder to feed the wrong stream through a pipeline.

Checkpoint: If command -v prints nothing, install Netpbm through your normal system package process. Do not drop an unrelated binary into a shared directory as a workaround.

2. Convert to a new PBM file

Replace /path/to/face.ybm with the actual file. The redirection creates face.pbm and does not touch the face file itself:

$ ybmtopbm /path/to/face.ybm > face.pbm
$ printf 'converter exit status: %s\n' "$?"
converter exit status: 0

A zero status means the command completed without reporting an error. The output is a PBM image, not a text description of the face, so do not open a binary PBM in a text editor and mistake unreadable characters for corruption.

There are no ybmtopbm-specific command-line options in this installed manual, only the options shared by libnetpbm programs generally. The input file and output redirection are enough for this workflow; if you add a common option, check that option against your own installed Netpbm version rather than assuming another converter treats it identically.

3. Verify the PBM header and dimensions

Use file for a quick, read-only check:

$ file face.pbm
face.pbm: Netpbm image data, size 4 x 3, rawbits, bitmap

Your own description will differ, dimensions and plain-or-raw included. What matters is that the file is recognised as a Netpbm bitmap and that the width and height are plausible for the source.

For a more focused check, look only at the first header bytes:

$ od -An -N 20 -tc face.pbm
   P   4  \n   4       3  \n

A PBM magic number is P1 for plain text or P4 for raw bitmap data, and the next fields are width then height. The sample above is raw PBM at 4 by 3. Do not expect exact wording from file itself: that separate utility's output can vary by version.

Checkpoint: Compare the reported dimensions against what the consuming program actually needs, before deleting or replacing the source. A successful conversion can still hand you an image with dimensions you did not intend.

4. Use standard input and output when that helps

With no face file argument, feed the face data on standard input, useful when another program has already selected or unpacked the source:

$ ybmtopbm < /path/to/face.ybm > face.pbm
$ file face.pbm
face.pbm: Netpbm image data, size 4 x 3, rawbits, bitmap

This is equivalent to naming the input directly. Keep the input and output paths distinct: shell redirection opens the output file before the program runs, so ybmtopbm face.ybm > face.ybm can destroy the source before conversion ever reads it.

For a pipeline, make the boundaries explicit:

$ fetch-face-file | ybmtopbm > received.pbm
$ test -s received.pbm && printf '%s\n' 'PBM output is non-empty'
PBM output is non-empty

fetch-face-file is a placeholder for your own trusted producer, not something Netpbm ships. If that producer can fail, write to a temporary output and move it into place only once both commands succeed:

$ tmp='received.pbm.new'
$ rm -f -- "$tmp"
$ fetch-face-file | ybmtopbm > "$tmp" && test -s "$tmp" && mv -- "$tmp" received.pbm
$ rm -f -- "$tmp"

Recovery: that final cleanup is safe because tmp is one specific file in the current directory. If the pipeline fails, the old received.pbm is left untouched; inspect the error before retrying, and remove only the incomplete temporary file.

5. Diagnose the common failures

ybmtopbm: command not found means the executable is missing from your PATH, not that the face file is invalid. Recheck the package installation and command -v before anything else.

An error opening the input usually means a wrong path or unreadable permissions. An error while writing the output points to a full filesystem, a missing directory, or insufficient write permission, none of which running as root by habit actually fixes.

Malformed or unsupported face data can make the converter fail before it produces anything useful. Keep the original and test a known-good face file if one exists. If the command exits cleanly but the dimensions or appearance are wrong, treat that as a source-data problem: check the PBM with file and a trusted viewer or later Netpbm converter.

Do not delete the input just because the exit was successful. Keep it until the PBM has passed whatever downstream check you actually care about. To undo this guide's own changes, delete the newly created output, for example rm -- face.pbm, but only once you have confirmed that path is the generated one.

Done means