Convert an HP ThinkJet Capture to PBM with thinkjettopbm
You will finish with a PBM bitmap generated from an HP ThinkJet printer-command file, plus a quick check that tells you whether the conversion produced a useful image. Allow about fifteen minutes. You need Netpbm, a readable ThinkJet capture, and a working directory where you can create a new output file. The examples use Netpbm 11.5.2 from Debian package 2:11.05.02-1.1build1, as installed on the machine used for this guide.
The route
Jump straight to the step you need, or tick off Done means at the end.
The command reads HP ThinkJet commands and writes PBM data to standard output. It silently ignores ordinary text and command sequences outside the small graphics subset it understands. That limitation matters: a successful command can still produce an empty or incomplete bitmap.
1. Check the installed command
Confirm the executable and package version first. These are ordinary, read-only commands and do not need elevated privileges:
$ command -v thinkjettopbm
/usr/bin/thinkjettopbm
$ dpkg-query -W -f='${Package} ${Version}\n' netpbm
netpbm 2:11.05.02-1.1build1
$ thinkjettopbm -version 2>&1 | head -n 2
thinkjettopbm: Using libnetpbm from Netpbm Version: Netpbm 11.5.2
thinkjettopbm: Built from source dated 2024-03-31 09:09:47
The manual calls the diagnostic switch -d. This installed build also accepts the longer -debug spelling and reports diagnostics on standard error. Keep those diagnostics separate from the PBM stream.
Checkpoint
Stop here if the command is missing or the version is not the one you intended to test. Do not copy a converter from another host into /usr/local/bin as a quick fix; use your normal package-management process and then repeat this check.
2. Inspect the input without changing it
Replace /path/to/capture.thinkjet with the actual file. The command only reads this path:
$ ls -l -- /path/to/capture.thinkjet
$ test -r /path/to/capture.thinkjet && echo readable
readable
A ThinkJet capture is a printer-command stream, not a PBM file. Do not run file and reject it merely because it does not identify a familiar image type. Preserve the original capture while you test the conversion. If it belongs to another user or a protected directory, ask for access or copy it to a working directory through your normal approved process. There is no reason to use sudo for a file you can already read.
The manpage documents standard input as an alternative to a named file. On this local build, an explicit path is less ambiguous. If a pipeline is necessary, pass the input stream as /dev/stdin rather than assuming a lone hyphen is accepted:
$ command-that-produces-the-capture | thinkjettopbm /dev/stdin > converted.pbm
$ printf 'converter status: %s\n' "$?"
converter status: 0
That placeholder producer must be replaced with the program that actually emits your capture. Do not paste an untrusted filename into a shell command without quoting it.
3. Convert to a new PBM file
Write to a new destination so an existing result is not truncated by shell redirection. This is an ordinary, unprivileged conversion:
$ thinkjettopbm /path/to/capture.thinkjet > capture.pbm
$ printf 'converter status: %s\n' "$?"
converter status: 0
$ ls -lh -- capture.pbm
-rw-r--r-- 1 user user 12K Sep 27 12:00 capture.pbm
The size and timestamp in the final line are examples of the fields to inspect, not values to expect. A zero-byte file usually means the command failed before writing a PBM header. A small but non-empty file is not automatically useful, because an input with no recognised graphics can produce a valid-looking PBM header with zero dimensions.
Checkpoint
Keep /path/to/capture.thinkjet unchanged and make sure capture.pbm is the new file. If capture.pbm already exists and contains something valuable, stop before running the command or choose another output name. Redirection overwrites the destination before the converter starts.
4. Verify the PBM header and dimensions
Use the Netpbm inspection tool if it is installed:
$ pnmfile capture.pbm
capture.pbm: PBM raw, 640 by 480
$ file capture.pbm
capture.pbm: Netpbm image data, size = 640 x 480, rawbits, bitmap
The exact wording varies between pnmfile and file, but you want a PBM image with positive dimensions. Do not treat the command's exit status alone as proof of a good picture. For example, converting a text-only test stream on this installed build exits successfully and writes the header P4\n0 0\n; that is a conversion result, but not a usable image.
If pnmfile rejects the output, inspect the first bytes without editing the file:
$ xxd -g1 -l 32 -- capture.pbm
00000000: 50 34 0a 36 34 30 20 34 38 30 0a ... P4.640 480....
$ pnmfile capture.pbm
capture.pbm: PBM raw, 640 by 480
P4 identifies a raw PBM stream. The width and height follow its header. If the dimensions are zero, or the header is absent, stop and diagnose the input instead of passing the file to another image tool.
5. Use debug output when the result is empty
Run the same input with -d, sending PBM output to one file and diagnostics to another:
$ thinkjettopbm -d /path/to/capture.thinkjet > capture-debug.pbm 2> capture-debug.log
$ printf 'converter status: %s\n' "$?"
converter status: 0
$ sed -n '1,20p' capture-debug.log
thinkjettopbm: Got 480 rows, 640 columns
Row and column counts depend on the capture. The useful question is whether the diagnostic reports positive dimensions and whether pnmfile capture-debug.pbm agrees. The debug switch does not broaden the command parser or add support for unsupported ThinkJet sequences; it only reports what the converter processed.
If the log reports zero rows or zero columns, check that the capture really contains graphics commands. The program ignores text and non-graphics sequences by design, and the manual warns that only a small subset of ThinkJet commands is implemented. A valid printer stream can therefore be outside this tool's coverage.
6. Inspect or convert the result
PBM is a one-bit bitmap. Use a trusted viewer, or convert it with another Netpbm tool after the header and dimensions pass inspection. For example, if pnmtopng is installed:
$ pnmtopng capture.pbm > capture.png
$ file capture.png
capture.png: PNG image data, 640 x 480, 1-bit grayscale, non-interlaced
This is a separate conversion. It does not make thinkjettopbm understand more ThinkJet commands. If the PBM is empty or visually incomplete, keep the original capture and investigate its command stream, rather than repeatedly converting the same bad result.
There is no persistent service or system setting to undo in this workflow. To discard an unneeded generated result, first confirm that the original capture is retained and that no later process needs the output, then remove only the named generated files:
$ rm -- capture.pbm capture-debug.pbm capture-debug.log capture.png
This removal is irreversible. Do not include the original capture in the command, and do not use a broad wildcard in a directory containing source files.
Done means
thinkjettopbmis installed and its Netpbm version is known.- The original ThinkJet capture is readable and remains untouched.
- The converter wrote PBM data to a new file without mixing diagnostics into it.
pnmfilereports positive dimensions and the PBM can be inspected or opened.- Debug output was checked when the result was empty or incomplete.
- You understand that successful execution does not prove that every ThinkJet command was supported.