Home / Alt manpages / gouldtoppm(1)

  • gouldtoppm(1)
  • User command
  • linux

Convert Gould Scanner Files to PPM with gouldtoppm

Nobody remembers where Gould scanners went, but gouldtoppm still turns the odd files they left behind into plain PPM images. Allow about fifteen minutes if the scanner file is already on disk. The examples use Netpbm 11.05.02, installed here as Debian package version 2:11.05.02-1.1build1.

You need a shell, the netpbm package, and a readable Gould scanner file. The converter reads the source and writes a PPM image: no graphical session, no service restart and no elevated privileges, as long as you can already read the source and write the destination.

1. Check the installed converter

Confirm which executable your shell will run and record the package version. These are ordinary, read-only checks:

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

The installed manual describes the command as gouldtoppm [gouldfile]. It has no options specific to Gould input, but it does accept the common Netpbm options, including -quiet, -version and -plain; the last one asks for plain ASCII PNM output where the program generates PNM. Start without these options so the normal binary PPM output stays clear.

Checkpoint

Check the command's own help path before you build it into a script.

$ gouldtoppm --help
gouldtoppm: Use 'man gouldtoppm' for help.

That message is simply the behaviour of this installed build. The full contract lives in the manual page, not in a dedicated help screen.

2. Check the source without changing it

Set a shell variable to the actual input path, then confirm it is a regular, readable file:

$ input='/path/to/scanner-output.gould'
$ test -f "$input" && test -r "$input" && echo 'input is a readable file'
input is a readable file

Replace the placeholder with the path your scanner workflow actually uses. The file name is not a format check: a Gould file can have a site-specific name, and the converter does not infer extra settings from it. If the test prints nothing, inspect the path with ls -l -- "$input" and fix the path or permissions before converting.

Do not reach for sudo just because the input came from older hardware. Use it only if your filesystem policy genuinely blocks the intended user from reading the source or writing the destination. Running the converter as root will not repair an invalid scanner file.

3. Write the PPM to a new file

gouldtoppm writes the image to standard output, so redirect it to a destination in your working directory:

$ output='gould-output.ppm'
$ gouldtoppm "$input" > "$output"
$ printf 'exit status: %s\n' "$?"
exit status: 0

No image data should land on the terminal. A status of zero means the command completed, not that the image looks correct. Keep the original scanner file until you have checked the PPM.

Warning

Shell redirection opens and truncates the destination before gouldtoppm even starts. Do not redirect straight onto a useful existing image unless replacing it is deliberate and recoverable. A safer pattern uses a temporary name in the same directory:

$ temporary='gould-output.ppm.new'
$ gouldtoppm "$input" > "$temporary" && mv -- "$temporary" "$output"

The mv only runs after a successful conversion. If the converter fails, the old destination stays exactly where it was, and you can remove the incomplete temporary file after inspecting it with rm -- "$temporary". That removal is irreversible, so check the name before you run it.

4. Verify that the result is a PPM

Check that the output exists, is non-empty, and is recognised as an image:

$ test -s "$output" && echo 'output is non-empty'
output is non-empty
$ pamfile "$output"
gould-output.ppm: PPM raw, 8 bits/sample, 3 channels

The wording from pamfile can include dimensions and can vary between Netpbm builds. What matters is that it recognises a PPM file. You can also peek at the first two bytes without dumping the binary pixel data:

$ head -c 2 "$output"; printf '\n'
P6

P6 is the magic number for raw binary PPM. Do not open the whole file in a text editor: the header is readable text, but the pixel data is binary. If a viewer or a later Netpbm command rejects the file, keep the source and rerun the conversion to a fresh temporary destination rather than overwriting your only copy.

5. Use common Netpbm options only when needed

The gouldtoppm manual has no Gould-specific switches, but the shared Netpbm options are useful in a controlled script:

  • -quiet suppresses noise. It hides informational messages sent through the Netpbm message service. It does not suppress errors.
  • -version reports the library. It prints the linked Netpbm library version instead of converting an input file.
  • -plain forces ASCII output. It asks a PNM-producing program for plain ASCII output instead of raw binary output.

For example, record the library version without creating an image:

$ gouldtoppm -version
gouldtoppm: Using libnetpbm from Netpbm Version: Netpbm 11.5.2
gouldtoppm: Built from source dated 2024-03-31 09:09:47
gouldtoppm: Built by Debian
gouldtoppm: BSD defined
gouldtoppm: RGB_ENV='RGBDEF'
gouldtoppm: RGBENV= 'RGBDEF' (env vbl is unset)

Exact version text can differ, so treat the command's own output as the authority for your host. Use -plain only when a downstream tool specifically needs ASCII PPM: it makes the result much larger and does nothing for the actual conversion. Netpbm options accept two hyphens as well as one, but the short documented spelling is easier to spot in older scripts.

6. Diagnose a failed conversion

Capture the status immediately and check the input again:

$ gouldtoppm "$input" > "$temporary"
$ status=$?
$ printf 'gouldtoppm status: %s\n' "$status"
gouldtoppm status: 1
$ ls -l -- "$input"

The non-zero value above is an example of failure, not a promised code for every bad input. Read the error printed on standard error, confirm the source really is the Gould scanner file you meant, and check the destination filesystem has space. If an output file exists after a failure, treat it as untrusted and do not promote it with mv.

If the command is missing, install or repair the package through your normal system-management process. If the source is unreadable, fix ownership or permissions through your usual policy. Neither problem is fixed by changing the scanner file in place. When the input looks valid and the output still fails verification, keep the original and test the conversion on a separate copy so later investigation cannot damage the evidence.

Done means

  • Converter confirmed. gouldtoppm resolves to the expected Netpbm installation and its version is recorded.
  • Source untouched. The Gould scanner file is readable and remains exactly as it was.
  • Output redirected on purpose. The converter's standard output was written to a file you deliberately chose.
  • Format verified. The result is non-empty and pamfile or its PPM magic number confirms the format.
  • Nothing lost. An existing image was not truncated by accident, and a failed replacement can be discarded without losing the previous output.