Home / Alt manpages / pc1toppm(1)

  • pc1toppm(1)
  • User command
  • linux

Convert Atari Degas PC1 Files to PPM with pc1toppm

You will convert an Atari Degas .pc1 image into a PPM file that Netpbm and other image tools can read. The input stays untouched; the image data goes to standard output, so you choose the output file with shell redirection. Allow about ten minutes for a known-good file, or a little longer if you need to identify a damaged archive.

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 records that pc1toppm was introduced in Netpbm 10.22, so the examples below describe the installed command and its documented interface, not a promise about every old build.

1. Check the installed command

Confirm that the executable is available before looking for problems in the image:

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

The help response is short because this program has no options defined specifically for it. It accepts one optional input filename and recognises the options common to libnetpbm programs. Do not go hunting for width, height or resize switches in this command: they are not part of the pc1toppm interface.

Checkpoint

If command -v prints nothing, install or repair Netpbm through your normal package-management process. The conversion itself should not need sudo. Reading an archive and writing a PPM in a working directory are ordinarily unprivileged operations.

2. Inspect the input without changing it

Use a path to the actual PC1 file. A filename ending in .pc1 is a useful hint, but it does not prove that the contents are a valid Atari Degas image. Check that the file exists and is readable:

$ 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 variation of the Atari Degas PI1 format. pc1toppm reads that compressed form and expands it into a PPM image. It does not edit the source, unpack a directory or infer a replacement file name.

3. Convert the file to PPM

Redirect standard output to a new destination:

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

A successful run normally has no progress message because the converted image is the command's standard output. Verify 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 the file output are examples of the information to check, not fixed values to assume. The Atari source determines the image dimensions. Your system's file wording may differ, but a non-empty PPM identified as an image is the useful result.

PPM files can contain binary pixel data, so do not open the whole output in a text editor. If you want a quick header check, inspect only the first few bytes:

$ head -c 2 image.ppm
P6

P6 is the binary PPM form. Preserve the original PC1 until you have opened or otherwise checked the converted image.

4. Avoid losing an existing output

Shell redirection with > truncates its destination before pc1toppm starts. That is harmless for a new name, but it can destroy a useful PPM if the input is corrupt. Use a temporary output and replace the destination only after verification:

$ 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

The mv command changes the directory entry and can replace an existing image.ppm. Treat it as the point of no return for that destination: make a backup first if the old output matters. If conversion or verification fails, leave the old file in place and remove the incomplete image.ppm.new with an explicit path after checking that it is the temporary file you intended.

5. Diagnose a failed conversion

Start with the input rather than adding guessed options. An empty or truncated file produces an error such as Unexpected end of input file and no useful PPM output:

$ 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 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 successfully but a viewer rejects the result, compare the PPM header and dimensions with the source you intended to convert. A successful process exit says that the decoder completed; it does not prove that you selected the right file or that an archive was not already damaged in a way the decoder could accept. Do not delete the source while investigating.

6. Pass the PPM to another tool

PPM is an interchange format, not necessarily the most convenient format for storage or sharing. After checking image.ppm, pass it to a separate converter that is installed on your system. For example, if Netpbm's PNG converter is available:

$ 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 optional step is not part of pc1toppm. If pnmtopng is absent, keep the verified PPM or use another trusted image tool. Avoid adding sudo merely because a conversion failed: elevated privileges do not repair an invalid PC1 file.

Done means

  • pc1toppm is the installed Netpbm command you intended to use.
  • The PC1 input is readable and remains unchanged.
  • The command exits successfully and writes a non-empty PPM.
  • The PPM header and dimensions have been checked before any later conversion.
  • An existing output is protected by a temporary filename or a deliberate backup.
  • Failures are investigated from the path, file contents and exit status, not by inventing unsupported options.