Home / Alt manpages / pc1toppm(1)

  • pc1toppm(1)
  • User command
  • linux

Convert Atari Degas PC1 Files to PPM with pc1toppm

Find an old .pc1 file from an Atari ST archive and pc1toppm is the command that turns it into a PPM your current image tools can actually open. The input stays untouched: image data goes to standard output, and you choose the destination with shell redirection. Allow about ten minutes for a known-good file, longer if you need to work out whether an archive is damaged.

You need a Linux shell, the netpbm package, and a readable Atari Degas PC1 file. The installed package on this machine is Netpbm 11.05.02. The manual page is dated 30 April 2004 and notes that pc1toppm arrived in Netpbm 10.22, so what follows describes the installed command and its documented interface, not a guarantee about every historic build.

1. Check the installed command

Confirm the executable exists before you go looking for problems in the image itself:

$ command -v pc1toppm
/usr/bin/pc1toppm
$ pc1toppm --help
pc1toppm: Use 'man pc1toppm' for help.

The short help response is not a bug, this program simply has no options of its own. It takes one optional input filename and recognises the options common to libnetpbm programs. Do not go hunting for width, height or resize switches here: they are not part of the pc1toppm interface at all.

Checkpoint

If command -v prints nothing, install or repair Netpbm the normal way for your system. The conversion itself should not need sudo: reading an archive and writing a PPM in your own working directory are ordinarily unprivileged.

2. Inspect the input without changing it

Point the command at the actual PC1 file. A .pc1 extension is a useful hint, not proof the contents are a valid Atari Degas image. Check that the file exists and is readable first:

$ ls -l /path/to/image.pc1
$ test -r /path/to/image.pc1 && echo 'input is readable'
input is readable

PC1 is the compressed, run-length-encoded cousin of the Atari Degas PI1 format. pc1toppm reads that compressed form and expands it into a PPM image. It never edits the source, unpacks a directory, or invents a replacement filename on your behalf.

3. Convert the file to PPM

Redirect standard output to a new destination:

$ pc1toppm /path/to/image.pc1 > image.ppm

A successful run is usually silent, because the converted image is the command's standard output. Check both the exit status and the result:

$ printf 'exit status: %s\n' "$?"
exit status: 0
$ file image.ppm
image.ppm: Netpbm image data, size 640 x 400, rawbits, pixmap

The dimensions in that file output are an example of what to look for, not fixed values to expect. The Atari source itself decides the dimensions, and your system's file wording may read slightly differently, a non-empty PPM identified as an image is what matters.

PPM files can hold binary pixel data, so do not open the whole thing in a text editor. For a quick header check, look only at the first couple of bytes:

$ head -c 2 image.ppm
P6

P6 marks the binary PPM form. Keep the original PC1 around until you have opened or otherwise verified the converted image.

4. Avoid losing an existing output

Shell redirection with > truncates its destination before pc1toppm even starts. That is harmless for a brand-new name, but it can destroy a perfectly good PPM if the input turns out to be corrupt. Write to a temporary output and only replace the destination after checking it:

$ pc1toppm /path/to/image.pc1 > image.ppm.new
$ test -s image.ppm.new
$ file image.ppm.new
image.ppm.new: Netpbm image data, size 640 x 400, rawbits, pixmap
$ mv image.ppm.new image.ppm

mv here changes the directory entry and can replace an existing image.ppm outright. Treat it as the point of no return for that destination, and back up the old output first if it matters. If conversion or verification fails, leave the old file alone and remove the incomplete image.ppm.new by its exact path once you have confirmed it is the temporary file you meant.

5. Diagnose a failed conversion

Start with the input itself rather than guessing at options. An empty or truncated file produces an error like Unexpected end of input file and no usable PPM:

$ pc1toppm /path/to/broken.pc1 > broken.ppm
pc1toppm: Unexpected end of input file
$ printf 'exit status: %s\n' "$?"
exit status: 1
$ wc -c broken.ppm
0 broken.ppm

If the command cannot even open the input, check the path and permissions:

$ ls -l /path/to/image.pc1
$ test -r /path/to/image.pc1 && echo readable || echo 'not readable'

If the command exits cleanly but a viewer rejects the result, compare the PPM header and dimensions against the source you meant to convert. A successful exit only says the decoder finished, it does not prove you picked the right file, or that an archive was not already damaged in a way the decoder happily accepted anyway. Do not delete the source while you are still investigating.

6. Pass the PPM to another tool

PPM is an interchange format, not necessarily the most convenient one for storage or sharing. Once image.ppm checks out, hand it to whatever converter is actually installed on your system. If Netpbm's PNG converter is available, for example:

$ command -v pnmtopng
/usr/bin/pnmtopng
$ pnmtopng image.ppm > image.png
$ file image.png
image.png: PNG image data, 640 x 400, 8-bit/color RGB, non-interlaced

This step is optional and has nothing to do with pc1toppm itself. If pnmtopng is missing, keep the verified PPM or reach for another trusted image tool. Do not add sudo just because a conversion failed: elevated privileges will not repair an invalid PC1 file.

Done means

  • Command confirmed. pc1toppm is the installed Netpbm command you meant to use.
  • Input untouched. The PC1 input is readable and unchanged.
  • Conversion succeeded. The command exits cleanly and writes a non-empty PPM.
  • Output checked. The PPM header and dimensions were verified before any further conversion.
  • Old output protected. A temporary filename or a deliberate backup kept the existing output safe.
  • Failures investigated properly. Path, file contents and exit status were checked rather than reaching for unsupported options.