Home / Alt manpages / pi1toppm(1)

  • pi1toppm(1)
  • User command
  • linux

Convert an Atari Degas PI1 File to PPM with pi1toppm

You will turn an Atari Degas .pi1 file into a PPM image that other Netpbm programs can read. The converter writes the image to standard output, so the safe pattern is to redirect it to a new destination and then inspect the result. Allow about ten minutes when the input file is already available.

1. Check the installed command

This guide assumes a Linux system with the netpbm package installed and a readable Atari Degas PI1 file. On the system used for these examples, the package is Netpbm 11.5.2, installed as Debian package version 2:11.05.02-1.1build1. The manual page is brief: pi1toppm takes one optional input file, has no command-specific options, and produces PPM output.

$ command -v pi1toppm
/usr/bin/pi1toppm
$ pi1toppm -version
pi1toppm: Using libnetpbm from Netpbm Version: 11.5.2
...

The version output has more build details than shown here. Use it when comparing results between machines. The program also accepts the common Netpbm options -quiet, -version and -plain; the last one requests plain, ASCII PPM output.

2. Convert one PI1 file to PPM

Run the conversion as an ordinary user in a directory where you can write. Replace the example paths with your actual input and output names:

$ pi1toppm /path/to/image.pi1 > /path/to/image.ppm

The input is not modified. The output is written to standard output, which is why the shell redirection is essential. Messages such as informational Netpbm notices go to standard error, so they do not normally become part of the PPM file.

Checkpoint

Verify the exit status and inspect the new file before opening it in an image viewer.

$ test $? -eq 0 && echo "conversion succeeded"
conversion succeeded
$ file /path/to/image.ppm
/path/to/image.ppm: Netpbm image data, size = 320 x 200, rawbits, pixmap
$ head -c 2 /path/to/image.ppm
P6

A PI1 image is normally the 320 by 200 Atari Degas low-resolution format. Treat the dimensions reported by file as the check, rather than relying on the filename. The raw PPM header begins with P6. Its pixel data is binary, so do not edit the complete file in a text editor.

3. Keep redirection from destroying an existing image

Shell redirection with > truncates its destination before pi1toppm starts. If image.ppm already matters, write to a temporary name first:

$ pi1toppm /path/to/image.pi1 > /path/to/image.ppm.new
$ file /path/to/image.ppm.new
/path/to/image.ppm.new: Netpbm image data, size = 320 x 200, rawbits, pixmap
$ mv /path/to/image.ppm.new /path/to/image.ppm

The final mv replaces the old output only after the conversion and inspection have succeeded. If conversion fails, leave the old file in place and remove the incomplete .new file when you have confirmed it is no longer needed. That removal is irreversible, so check the exact path first:

$ ls -l /path/to/image.ppm.new
$ rm /path/to/image.ppm.new

There is no reason to run this conversion with sudo. Use elevated privileges only if the input directory genuinely denies your user read access or the destination denies write access. Prefer copying the files into a working directory you own instead of changing broad permissions.

4. Use the common Netpbm options deliberately

Use -quiet when a script must keep diagnostics out of its terminal, while still checking the command's exit status:

$ pi1toppm -quiet /path/to/image.pi1 > /path/to/image.ppm
$ status=$?
$ test "$status" -eq 0 && echo "PPM written"
PPM written

Use -plain only when a downstream tool specifically needs an ASCII PPM. It makes the file larger and does not improve the image. For a normal binary PPM, omit it:

$ pi1toppm -plain /path/to/image.pi1 > /path/to/image-plain.ppm
$ head -c 2 /path/to/image-plain.ppm
P3

Do not invent resize or palette options for this command. The pi1toppm(1) manual defines no options specific to PI1 conversion. If you need a later resize or format change, perform it as a separate, verified Netpbm step.

5. Diagnose the likely failures

An input error usually means the path is wrong, the file is unreadable, or the file is not a valid PI1 image. Check those facts without changing anything:

$ ls -l /path/to/image.pi1
$ test -r /path/to/image.pi1 && echo readable
$ pi1toppm /path/to/image.pi1 > /tmp/image-check.ppm
$ echo "exit status: $?"
$ file /tmp/image-check.ppm

If the command fails, do not treat a zero-byte or partial output as a valid image. Use a new temporary destination, review the diagnostic on standard error, and retry only after correcting the input or path. Keep the original PI1 file until the PPM has been checked by file and, if needed, a trusted viewer or a later converter.

Done means

  • pi1toppm -version identifies the installed Netpbm library and version.
  • The readable .pi1 file was converted without elevated privileges.
  • The exit status is zero and the PPM is non-empty with a P6 or deliberately selected P3 header.
  • The output dimensions match the PI1 image, normally 320 by 200.
  • An existing PPM was protected by converting to a new name before replacement.