Home / Alt manpages / pbmtox10bm(1)

  • pbmtox10bm(1)
  • User command
  • linux

Replace pbmtox10bm with the X10-Compatible Netpbm Command

You will finish with an X10 bitmap made from a PBM source, a byte-for-byte check against the legacy command, and a safe replacement for scripts that still call pbmtox10bm. On this machine the installed package is Netpbm 2:11.05.02-1.1build1, providing Netpbm version 11.5.2.

Allow about ten minutes. You need a shell, Netpbm's PBM tools, and a PBM file. These examples only read the input and write a new file. They do not need elevated privileges. The command name is obsolete, so treat it as a compatibility check rather than a new dependency.

1. Confirm which commands are installed

Check the executable paths and package version before changing a script. This is an ordinary read-only step:

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

The installed documentation says that pbmtox10bm was replaced in Netpbm 10.37, released in December 2006. The replacement is pbmtoxbm. Do not infer that the old executable's presence makes it the right choice for new work: it is present here for compatibility with old software.

Checkpoint

Both commands should resolve to an executable. If pbmtoxbm is missing, stop here and install or select a Netpbm package that provides it rather than silently keeping a new use of the legacy name.

2. Convert a PBM file with the legacy command

The old command accepts a PBM file argument and writes the X10 bitmap to standard output. Redirect that output to a new file:

$ pbmtox10bm input.pbm > output-x10.xbm

input.pbm is a placeholder; replace it with the path to your existing PBM file. The redirection operator creates or replaces output-x10.xbm. Check the exit status immediately after the conversion:

$ printf 'conversion status: %s\n' "$?"
conversion status: 0

Status 0 means that the command completed successfully. A non-zero status means the result is not trustworthy. Common causes are a missing input path, an invalid PBM file, or an output directory where you cannot create files. The command's standard output is the bitmap, so avoid adding diagnostic text to that stream when using it in a pipeline.

3. Use the supported replacement for X10 output

Use pbmtoxbm with -x10 for the same output format:

$ pbmtoxbm -x10 input.pbm > output-x10-new.xbm
$ printf 'conversion status: %s\n' "$?"
conversion status: 0

The option is the important part. Without it, pbmtoxbm produces the X11 form, which is its default. X10 and X11 are different X bitmap variants; changing the default without checking the consumer can break an old build or display tool. Do not specify -x10 and -x11 together.

For a one-off command, this is the migration:

$ pbmtoxbm -x10 input.pbm > output-x10.xbm

If the command succeeds, the output file has been replaced by a newly generated file. If you need the previous output, copy it elsewhere before running the redirection. Recovery is simply to restore that saved copy; there is no undo command for shell redirection.

4. Verify the migration on a known PBM

When changing a build or script, compare both commands using a temporary working area. This example creates a tiny PBM fixture under /tmp, converts it both ways, and compares the generated files:

$ printf 'P1\n3 2\n101\n010\n' > /tmp/pbmtox10bm-check.pbm
$ pbmtox10bm /tmp/pbmtox10bm-check.pbm > /tmp/legacy.xbm
$ pbmtoxbm -x10 /tmp/pbmtox10bm-check.pbm > /tmp/replacement.xbm
$ cmp /tmp/legacy.xbm /tmp/replacement.xbm
$ printf 'outputs match: %s\n' "$?"
outputs match: 0

cmp prints nothing when the files are identical and returns status 0. The test fixture is deliberately small, so it is easy to inspect if the comparison fails:

$ sed -n '1,10p' /tmp/replacement.xbm
#define pbmtox10bm_check_width 3
#define pbmtox10bm_check_height 2
static short pbmtox10bm_check_bits[] = {
 0x0005,0x0002};

The identifier is derived from the input name, so a different filename produces different identifier text even when the bitmap data is equivalent. Compare output files produced from the same input when testing a migration. Remove only these test files after inspection if you no longer need them; they are temporary and do not affect Netpbm or any service.

5. Update a script without changing its output format

Replace the command name and retain the -x10 option explicitly. For example, change this old line:

pbmtox10bm logo.pbm > logo.xbm

to this supported form:

pbmtoxbm -x10 logo.pbm > logo.xbm

Keep the output filename and any surrounding error handling unchanged until the comparison in the previous step passes. Do not substitute plain pbmtoxbm logo.pbm unless the consumer has been checked for X11 bitmap support. That command is valid, but it selects a different format.

Older Netpbm installations pre-dating 10.37 may not provide pbmtoxbm -x10. If one script must run against those installations, retain a compatibility branch and test it on the oldest supported version. The local Netpbm 11.5.2 installation supports the replacement option.

Done means

  • pbmtoxbm is available and reports success with -x10.
  • The migrated command creates the same X10 output as pbmtox10bm for a representative PBM input.
  • The script keeps -x10 when its consumer expects the legacy X10 format.
  • No source PBM file or service configuration was overwritten.