Home / Alt manpages / picttoppm(1)

  • picttoppm(1)
  • User command
  • linux

Convert Macintosh PICT Files to PPM with picttoppm

An old Macintosh PICT file is useless to most modern tools, but picttoppm turns it into a plain PPM image you can convert onward from. You will convert the file, keep the original untouched, and choose the options that matter when the file came from a resource or data fork. Allow about fifteen minutes for a normal conversion, plus time to inspect the result. The examples describe Netpbm 11.5.2, installed here as package version 2:11.05.02-1.1build1.

You need a readable PICT file and the picttoppm executable. The installed manual says that version 1 and version 2 PICT files are supported. PPM is deliberately a simple intermediate format, so use a separate Netpbm or image tool if you need PNG or another final format.

1. Check the executable before preparing a conversion

Start with a read-only check. It does not need elevated privileges:

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

The path and package version will differ between distributions. On this particular host, the package and manpage are installed but command -v picttoppm returns no path because the executable is absent. That is a packaging or installation issue, not a reason to invent a replacement command. Check the package contents and install the distribution component that supplies the executable through your normal package-management process:

$ dpkg -L netpbm | grep '/picttoppm$'
$ command -v picttoppm
$ printf 'status: %s\n' "$?"
status: 1

Do not use sudo for the checks. If the second command succeeds on your machine, continue with that executable. If it does not, stop here until the program is available.

2. Convert a normal PICT file to a new PPM

Use a new destination name and redirect the converter's standard output. Replace the placeholder path with a file you own:

$ picttoppm /path/to/input.pict > /path/to/output.ppm
$ printf 'status: %s\n' "$?"
status: 0
$ file /path/to/output.ppm
/path/to/output.ppm: Netpbm image data, ...

The command accepts one optional PICT file. With no file argument, it reads standard input, so this is also valid when another program supplies the bytes:

$ cat /path/to/input.pict | picttoppm > /path/to/output.ppm

The exact wording from file varies. Check that the output exists and is non-empty before opening it. A successful exit status confirms that the program completed; it does not confirm that every drawing command in the source was reproduced.

Warning

Redirection with > truncates an existing destination before picttoppm starts. To protect an existing image, write to a temporary name and replace it only after inspection:

$ picttoppm /path/to/input.pict > /path/to/output.ppm.new
$ test -s /path/to/output.ppm.new
$ file /path/to/output.ppm.new
$ mv -- /path/to/output.ppm.new /path/to/output.ppm

If conversion fails, remove the .new file and the previous output remains in place. The mv command is the state-changing step. Do not run it until the new file has passed your checks.

3. Select full resolution when image data was scaled

A PICT file can request that an embedded image be scaled down. Add -fullres when retaining the embedded image's full resolution matters:

$ picttoppm -fullres /path/to/input.pict > /path/to/full-resolution.ppm

This option has a sharp boundary: it disables all PICT operations except images, and it ignores text drawing commands. If the source contains labels, text may disappear. Netpbm 10.45 and later issue a warning when text is omitted; the installed 11.5.2 manual documents that behaviour. Compare the ordinary and full-resolution outputs before choosing one for an archive or publication.

4. Handle files without the usual 512-byte header

Normal PICT files have a 512-byte header. If your PICT bytes came from somewhere other than the file's data fork, and that extracted data does not include the header, use -noheader:

$ picttoppm -noheader /path/to/pict-data > /path/to/output.ppm

Do not add this option merely because a normal conversion failed. First establish how the bytes were extracted. Applying the wrong header mode can make valid data unreadable. Keep the original container or export until the PPM has been checked.

5. Control QuickDraw and diagnostic behaviour

Use -quickdraw when you want only pure QuickDraw operations and want special PostScript printer operations ignored:

$ picttoppm -quickdraw /path/to/input.pict > /path/to/quickdraw.ppm

For diagnostics, the installed syntax is -verbose=n, where n is 0, 1 or 2:

$ picttoppm -verbose=2 /path/to/input.pict > /path/to/output.ppm

Before Netpbm 10.98, repeated -verbose flags were used instead. Use the equals form on current releases and check the local manual when maintaining a script for an older system. Common Netpbm options, including -quiet, may also be available, but keep diagnostics enabled while investigating a bad conversion.

6. Supply fonts only when text rendering needs them

picttoppm has one built-in font and can read additional BDF fonts from a font directory file. It automatically reads a file named fontdir in the current directory, if one exists. That implicit lookup is an easy distraction: an unrelated file in the working directory can affect text rendering.

For a controlled conversion, pass an explicit additional font directory:

$ picttoppm -fontdir /path/to/fontdir /path/to/input.pict > /path/to/output.ppm
  • Each non-comment line has four whitespace-separated fields: font number, pixel size, style value and the BDF file name.
  • A comment starts with #.
  • The style value is a sum of flags: 1 for boldface, 2 for italic and 4 for underlined text.
  • The BDF files must exist and be readable.

Do not create a font mapping just to fix a missing executable, and do not delete an existing fontdir until you know which conversions depend on it.

7. Interpret failures and limitations

A missing command means the executable is unavailable. A failure opening the PICT usually means the path or permissions are wrong. A conversion that completes but loses artwork can reflect unsupported drawing commands: the manual says that image commands are fully implemented, while line, rectangle, polygon and text drawing are mostly implemented. Test representative files rather than assuming that every PICT is equivalent.

Keep the source file and compare the PPM with a trusted viewer. If text is missing, remove -fullres and retry, unless full-resolution image data is the higher priority. If printer-specific content is the problem, compare a normal run with -quickdraw. Neither option changes the input file, and neither requires root.

Done means

  • Executable confirmed: picttoppm is present and its local Netpbm version is known.
  • Original preserved: a new PPM was written without overwriting the original PICT or an existing output.
  • Output checked: the PPM is non-empty and its dimensions and appearance were checked.
  • Options used deliberately: -fullres, -noheader and -quickdraw were used only when their specific input condition applied.
  • Fontdir considered: any automatic or explicit fontdir file was considered before diagnosing text differences.
  • Limits understood: you know that unsupported drawing commands can produce an incomplete image even after a successful exit.