Home / Alt manpages / rlatopam(1)

  • rlatopam(1)
  • User command
  • linux

Convert RLA and RPF Images to PAM with rlatopam

rlatopam is the Netpbm tool that turns an old Alias/Wavefront RLA or RPF render into a PAM file you can actually open elsewhere. This guide runs on Netpbm 11.5.2, takes about ten minutes, and leaves the original render untouched throughout.

You need the netpbm package and a readable image file. One thing worth knowing up front: rlatopam only goes one way. There is no PAM-to-RLA mode, so this is strictly a read-and-convert tool.

1. Confirm the installed converter

Before you build anything into a script, check which binary you have and what it links against. Both commands are read-only and need no sudo:

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

-version reports the linked Netpbm library and exits; it does not convert anything. The local man page for this command is older than the installed package, so treat this version output as the source of truth over what the manual says. Two other shared Netpbm flags exist here too: -quiet silences informational messages, and -plain has no effect on PAM output, because PAM has no separate plain and raw variants.

2. Check the input before you touch it

Swap in your real path for /path/to/input.rla below. The file can be either RLA or RPF: the extension is just a label, not a setting.

$ ls -l /path/to/input.rla
$ test -r /path/to/input.rla && echo 'input is readable'
input is readable
  • File not found? Fix the path. Do not reach for elevated privileges to paper over a typo.
  • Permission denied? That is an ownership or directory-access issue, not a job for a hasty copy with loosened permissions.

3. Convert to a new PAM file

rlatopam writes PAM to standard output, so you redirect it to a file:

$ rlatopam /path/to/input.rla > converted.pam
$ printf 'rlatopam exit status: %s\n' "$?"
rlatopam exit status: 0

Status 0 just means the command ran to completion. It does not confirm dimensions or channel count. The result might be grayscale or RGB, with or without transparency, since PAM can represent either.

Checkpoint

The original file should still show its old timestamp and size, and the new file is a separate object entirely:

$ file /path/to/input.rla converted.pam
/path/to/input.rla: [description depends on the source]
converted.pam: Netpbm PAM image file
$ pamfile converted.pam
converted.pam:	PAM, [width] by [height] pixels, [tuple type] format

The bracketed values are placeholders for what you will actually see, not literal text to type. What matters is that file and pamfile recognise the output as PAM with plausible dimensions and tuple type. Keep the source around until that check and a look at the image both pass.

4. Feed it through a pipeline instead

The filename argument is optional. Leave it out and rlatopam reads RLA or RPF from standard input, which is handy when another program already produces the bytes:

$ cat /path/to/input.rpf | rlatopam > converted-from-rpf.pam
$ pamfile converted-from-rpf.pam
converted-from-rpf.pam:	PAM, [width] by [height] pixels, [tuple type] format

For a single local file, naming it directly is easier to audit later. Save the pipeline form for when the source is already a stream. Either way, never put a text filter between the producer and rlatopam: RLA and RPF are binary formats and a text tool will mangle them.

5. Do not clobber an existing output

Warning

Shell redirection with > truncates the destination the instant rlatopam starts, before conversion has even begun. If converted.pam already holds something you care about, write to a temporary name first and only replace the old file once you have checked the new one.

$ rlatopam /path/to/input.rla > converted.pam.new
$ pamfile converted.pam.new
converted.pam.new:	PAM, [width] by [height] pixels, [tuple type] format
$ mv converted.pam.new converted.pam

Treat that mv as the point of no return for the old file. If validation fails instead, leave the old output alone and clean up the half-finished attempt:

$ rm converted.pam.new

That removal cannot be undone, but it costs you nothing: rlatopam never touches the input image, so there is no source file to restore in the first place.

6. Diagnose a failed conversion

A missing input gives a non-zero status and a clear error on standard error. Here is a safe way to see it, since the path below points at nothing real:

$ rlatopam /tmp/does-not-exist.rla > failed.pam
rlatopam: Unable to open file '/tmp/does-not-exist.rla' for reading. fopen() returns errno 2 (No such file or directory)
$ printf 'status: %s\n' "$?"
status: 1
  • Empty or partial output file appears anyway. The shell creates the redirection target before rlatopam even runs, so a failed attempt can still leave a stub file behind. This is exactly why the temporary-name trick in step 5 matters.
  • Piped input and unclear status. Test the producer separately, and remember a pipeline's exit status is normally the last command's unless your shell has pipeline-failure checking switched on.
  • File has the right extension but still fails. An .rla or .rpf suffix on a file proves nothing about its contents. Recheck the producer, the permissions and the transfer, then rerun into a fresh temporary name.

Done means

  • Confirmed the tool and Netpbm version before relying on either.
  • Left the RLA or RPF source unchanged throughout.
  • Converted with status 0 and a PAM file to show for it.
  • Verified dimensions and tuple type with pamfile, not just a clean exit code.
  • Protected any existing output by converting to a new name before replacing it.
  • Never needed sudo or touched anything outside the two files involved.