Turn DiddleBug Sketches into PBM Files with ddbugtopbm

Your old Palm scribbles are sitting in a .pdb backup, and ddbugtopbm can turn each one into its own PBM image. Expect about fifteen minutes, plus however long it takes to find the backup.

You need the Netpbm package and a readable .pdb file such as DiddleBugDB.pdb. You end up with one PBM file per sketch in a separate output directory.

One trap first. The local manual page is older and shows the database path as an argument. The installed Netpbm 11.5.2 binary rejects arguments, so on this machine you give the database to standard input with shell redirection.

1. Check the installed command

Run this as an ordinary user. It changes nothing:

$ command -v ddbugtopbm
/usr/bin/ddbugtopbm
$ ddbugtopbm --version
ddbugtopbm: Using libnetpbm from Netpbm Version: Netpbm 11.5.2
ddbugtopbm: Built from source dated 2024-03-31 09:09:47
ddbugtopbm: Built by Debian

That version text is diagnostic output from this Debian build. The build date says nothing about the age of your Palm database, and it does not guarantee support for every historical database format.

Checkpoint: if command -v finds nothing, install Netpbm through your normal package-management process and repeat the check. The conversion itself needs no root access.

2. Find a copy of the Palm database

Work from a copy taken from the Palm backup directory, never the only copy of the original data. The file names depend on the app:

Inspect the directory without opening or changing any database:

$ find /path/to/palm/backup -maxdepth 1 -type f \( \
    -name 'DiddleBugDB.pdb' -o \
    -name 'DiddleDB.pdb' -o \
    -name 'DiddleIDB.pdb' \
\) -print

Replace /path/to/palm/backup with the real directory. If several copies exist, pick the backup with the sketches you want. Leave the source file untouched so you can retry with a different output directory.

Checkpoint: write down the exact input path. Your account must be able to read it, and it should be a file copied from the Palm backup rather than a live, changing location.

3. Make a separate output directory

Create a directory just for the generated PBM files, outside the Palm backup directory:

$ mkdir -p ~/ddbug-pbm
$ cd ~/ddbug-pbm

This is an ordinary user operation, and the separation matters. Named sketches can overwrite an existing PBM with the same name, and a clean directory keeps output away from the database you may need for another run.

Warning: do not put irreplaceable PBM files in this directory before converting unless you have a backup. A named sketch can replace a same-named PBM. Unnamed sketches instead try another filename, typically resembling sketch-0123.pbm.

Recovery: ddbugtopbm has no undo. To get back an overwritten named PBM, restore it from your own backup and remove only the generated files you no longer need.

4. Convert through standard input

Pass the database with <. Do not append the path as an argument on this installed version:

$ ddbugtopbm < /path/to/palm/backup/DiddleBugDB.pdb

For the original Diddle, use whichever database matches the sketches you want:

$ ddbugtopbm < /path/to/palm/backup/DiddleDB.pdb
$ ddbugtopbm < /path/to/palm/backup/DiddleIDB.pdb

You do not get one combined PBM. The command writes one appropriately named PBM per sketch into the current directory: named sketches keep their names, unnamed ones get generated names. Exact filenames depend on the records in the database, so never script against a guessed name.

Tip: if you accidentally run ddbugtopbm /path/to/file.pdb, the installed binary says it takes no arguments and exits unsuccessfully. Re-run with redirection. The old manual page's argument-style examples do not match this executable.

5. Check what came out

List the output directory and confirm PBM files exist:

$ find . -maxdepth 1 -type f -name '*.pbm' -printf '%f\n' | sort
$ file -- *.pbm

find prints nothing if no PBM was produced. If so, check the input path, read permission and database type before trying again. An empty or malformed database may make this old reader fail without a helpful diagnostic, and the manual page specifically warns that input checking is limited.

For a visual check, use a PBM-aware Netpbm utility that is already installed. For example, pbmtoascii can render a small sketch as text:

$ pbmtoascii < ./sketch-0123.pbm | sed -n '1,20p'

Swap in a filename printed by find. A large sketch can produce many lines, so the sed limit keeps the terminal manageable. If pbmtoascii is unavailable, the file result and the PBM header are still useful checks:

$ head -n 2 ./sketch-0123.pbm
P4
# comment or dimensions follow

The exact header layout can vary, because PBM permits comments and whitespace. Do not hand-edit a generated header unless you are deliberately repairing a file and have kept the original output.

6. Know the compatibility limits

The DiddleBug reader is documented as known to work with DiddleBug 2.50 databases. The manual says it may also work with later versions and probably with version 2.15, but that is not a promise.

A failure on a newer or damaged database is a compatibility problem. It is not a reason to overwrite the source, or to keep retrying in the same output directory. Keep each attempt isolated when testing uncertain files:

$ mkdir -p ~/ddbug-pbm-test-1
$ cd ~/ddbug-pbm-test-1
$ ddbugtopbm < /path/to/palm/backup/DiddleBugDB.pdb
$ find . -maxdepth 1 -type f -name '*.pbm' -print

If the database is empty, the program may fall over. Stop there and preserve the source database.

Warning: do not use sudo to compensate for a bad format. Elevated privileges do not repair database records, and they can leave root-owned output that is harder to manage.

Done means