Home / Alt manpages / pamtoxvmini(1)

  • pamtoxvmini(1)
  • User command
  • linux

Create an XV Thumbnail from a Netpbm Image with pamtoxvmini

pamtoxvmini generates the tiny thumbnail format that XV's old VisualSchnauzer browser reads. It writes to standard output, so your source image stays completely untouched: save the result under a new name and check it before you replace anything. Allow about ten minutes if the input file is ready.

This guide describes Netpbm 11.5.2, installed here as package version 2:11.05.02-1.1build1. The manual page is dated 2 April 2006, so check the installed command if you are working on a substantially different release.

1. Check the command and input

Confirm the executable is available and the source file is readable. Replace the example path with your own PAM or PNM file; these are ordinary, unprivileged checks.

$ command -v pamtoxvmini
/usr/bin/pamtoxvmini
$ test -r /path/to/input.pam && echo readable
readable
$ pamfile /path/to/input.pam
/path/to/input.pam: PAM, 640 by 480 by 3 maxval 255
    Tuple type: RGB

pamtoxvmini accepts one optional input filename; omit it and the command reads from standard input instead. The input must be a genuine Netpbm image, not an ordinary JPEG or PNG. Convert those formats to PAM or PNM with a suitable Netpbm tool first.

2. Convert to a new thumbnail file

Use shell redirection to capture the command's standard output. Pick a destination that does not already hold a useful thumbnail.

$ pamtoxvmini /path/to/input.pam > /path/to/output.xvmini
$ printf 'exit status: %s\n' "$?"
exit status: 0

There is normally no progress display. A zero exit status means the command finished, not that you picked the right image, so inspect the result before using it in a browser or archive.

In the installed Netpbm release, the output is itself a PAM image, with a P7 header and the dimensions of the generated thumbnail. Check that with pamfile:

$ pamfile /path/to/output.xvmini
/path/to/output.xvmini: PAM, 332 by 2 by 3 maxval 255
    Tuple type: RGB

Exact dimensions depend on the input, so do not treat the sample numbers above as a fixed default. This command converts an image into the XV thumbnail representation; it is not a general-purpose resize option.

3. Use standard input when a pipeline is clearer

Because the filename is optional, another command can feed the image straight in. This helps when the source was already picked by a script or another Netpbm program.

$ pamtoxvmini < /path/to/input.pam > /path/to/output-from-stdin.xvmini
$ pamfile /path/to/output-from-stdin.xvmini
/path/to/output-from-stdin.xvmini: PAM, 332 by 2 by 3 maxval 255
    Tuple type: RGB

Keep the input and output paths distinct while testing. A pipeline that writes back to its own input can truncate the source before the converter ever reads it.

4. Know which options actually apply

There are no options specific to pamtoxvmini itself, only the common Netpbm library options. Use -version to report the linked library version without converting anything:

$ pamtoxvmini -version
pamtoxvmini: Using libnetpbm from Netpbm Version: Netpbm 11.5.2
pamtoxvmini: Built from source dated 2024-03-31 09:09:47
pamtoxvmini: Built by Debian
  • Extra build details may print on this system, beyond the version line above.
  • -quiet suppresses informational messages sent through the Netpbm message service.
  • -plain does nothing useful here. It requests plain ASCII output for programs that generate PNM, but this command generates PAM, which has no plain and raw variants, so it will not give you a text thumbnail.
$ pamtoxvmini -quiet /path/to/input.pam > /path/to/output-quiet.xvmini
$ pamfile /path/to/output-quiet.xvmini
/path/to/output-quiet.xvmini: PAM, 332 by 2 by 3 maxval 255
    Tuple type: RGB

5. Avoid losing an existing result

Shell redirection with > truncates the destination before pamtoxvmini starts, which matters if a conversion fails halfway or you picked the wrong input. Write a temporary file, verify it, then replace the old result only once you are satisfied.

Warning

The final mv replaces the destination name. Do not run it until the new file passes your checks, and keep a backup if the old thumbnail is hard to recreate.

$ pamtoxvmini /path/to/input.pam > /path/to/output.xvmini.new
$ pamfile /path/to/output.xvmini.new
/path/to/output.xvmini.new: PAM, 332 by 2 by 3 maxval 255
$ cp --preserve=all /path/to/output.xvmini /path/to/output.xvmini.bak
$ mv /path/to/output.xvmini.new /path/to/output.xvmini

If conversion fails, remove only the incomplete .new file after checking its path; the original output stays put. Unwanted replacement? Restore it with mv /path/to/output.xvmini.bak /path/to/output.xvmini. Removing the backup is irreversible, so leave that cleanup until the new thumbnail has been tested.

6. Diagnose failures without using root

A missing-file error usually means a wrong path or a file the current user cannot read. Check those facts directly:

$ ls -l /path/to/input.pam
$ test -r /path/to/input.pam && echo readable
readable
  • Bad magic number reported? The file is not recognised as PAM, PNM, PBM, PGM or PPM. Check it with pamfile and convert it from its original format before retrying. Do not rename a JPEG or PNG to make its extension look like PAM: file contents, not names, determine the format.
  • Output empty or a non-zero status? Do not use it as a valid thumbnail. Re-run with the source path visible, check the diagnostic, and write to a fresh destination.
  • Do not reach for sudo. It is not required for conversion in a directory you can read and write, will not repair an invalid image, and can leave root-owned output that is harder to replace later.

Done means

  • Installed and versioned: pamtoxvmini is present and its Netpbm version is known.
  • Source verified: a readable PAM or PNM image, confirmed with pamfile.
  • Conversion succeeded: status 0, written to a separate destination.
  • Result checked: a non-empty PAM thumbnail with plausible dimensions.
  • Existing result protected until the replacement passed verification.
  • No root access or service restart was needed anywhere in the process.