Home / Alt manpages / pamx(1)

  • pamx(1)
  • User command
  • linux

Display a Netpbm Image in X with pamx

You will open a Netpbm image in an X Window System window, pass an image from another Netpbm command, and adjust the window when the default does not suit your display. Allow about fifteen minutes. You need the pamx program, a readable Netpbm image, and an active X display that your shell can access.

This guide follows the installed Netpbm 11.05.02 package. pamx is a small viewer, not a general image application: it reads Netpbm formats, displays the first image in a stream, and stops being useful when you need zooming, image editing or non-Netpbm decoding.

1. Check the installed command and the display

Start with read-only checks. They do not need elevated privileges and do not change your image or X session:

$ command -v pamx
/usr/bin/pamx
$ dpkg-query -W -f='${Package} ${Version}\n' netpbm
netpbm 2:11.05.02-1.1build1
$ printf 'DISPLAY=%s\n' "${DISPLAY:-not set}"
DISPLAY=:0

Your binary path, package revision and display value can differ. If DISPLAY is not set, pamx normally cannot know where to create its window. Run it from a graphical session, or arrange the correct X connection using your system's normal session and authentication tools. Do not copy a display value from another machine without understanding its X authentication.

Checkpoint

Continue only when command -v pamx finds the program and DISPLAY names the X server you intend to use.

2. Display an existing Netpbm file

Give the input path as the final argument. This does not modify the file:

$ file /path/to/image.ppm
/path/to/image.ppm: Netpbm image data, size 800 x 600, rawbits, pixmap
$ pamx /path/to/image.ppm

The program opens a window and displays the image. By default, the initial window matches the image size unless that would exceed 90 per cent of the screen dimensions. It does not resize the image to fit that limit. If the window is smaller than the image, drag the image with the first mouse button to view another area. Press q while the window has keyboard focus, or use Ctrl-C, to exit.

There is no useful terminal success message because the result is a graphical window. If the command returns immediately with an error, keep the terminal output: it usually identifies a missing display, an unreadable input or an unsupported X setup.

3. Feed the first image from a pipeline

With no input file, pamx reads standard input. That makes it useful for checking a Netpbm conversion without first saving an intermediate image:

$ pnmtoppm /path/to/source.pgm | pamx

The particular converter is only an example. Use a Netpbm command that produces a format accepted by your installed tools. Keep the pipe visible while troubleshooting: an error from the command on the left is different from an X error from pamx on the right.

A multi-image Netpbm stream is accepted, but pamx ignores every image after the first. If you expected an animation, contact sheet or sequence to appear, this is the reason it does not. Split or select the required image before passing the stream to pamx.

Checkpoint

Verify the producer separately when a pipeline fails:

$ pnmtoppm /path/to/source.pgm > /tmp/pamx-check.ppm
$ file /tmp/pamx-check.ppm
/tmp/pamx-check.ppm: Netpbm image data, size 800 x 600, rawbits, pixmap
$ pamx /tmp/pamx-check.ppm

The temporary file is disposable. Remove it after checking with rm -- /tmp/pamx-check.ppm if it contains no information you need. Do not redirect over a valuable image by accident: shell > truncates an existing destination before the producer runs.

4. Set a useful window title and position

Use -title when several viewer windows would otherwise be hard to identify. Use -geometry for a window size and position in the usual X geometry form:

$ pamx -title='Input preview' -geometry=640x480+80+60 /path/to/image.ppm

The geometry controls the window, not the pixel dimensions of the input. A value such as 640x480+80+60 requests a 640 by 480 window positioned 80 pixels from the left and 60 pixels from the top. Window managers may adjust the final result.

Use -fullscreen when the image should use the entire screen:

$ pamx -fullscreen /path/to/image.ppm

This can hide other windows and make the normal exit key less obvious. Keep keyboard focus on the image window and press q to leave it. There is no persistent configuration to undo: these options apply only to this process.

5. Handle colour and visual problems deliberately

On older or constrained X displays, colours may look wrong or the image may use an inconvenient colormap. The default behaviour allocates shared colours unless there are not enough available. Try -fit to force the default visual and colormap:

$ pamx -fit /path/to/image.ppm

This can reduce display quality, so compare it with the default. -private requests a private colormap, which may improve the image but can make other windows change appearance while this window has focus:

$ pamx -private /path/to/image.ppm

Do not use -install as a general fix. It forcibly installs the image colormap when focused and violates the Inter-Client Communication Conventions Manual. It exists for window managers that do not install colormaps correctly. The manual specifically limits it to that situation.

For a diagnostic, request a named visual and ask for verbose messages:

$ pamx -verbose -visual=TrueColor /path/to/image.ppm

Available visual names include DirectColor, TrueColor, PseudoColor, StaticColor, GrayScale and StaticGray. Use this only when the X server provides the visual. The verbose output goes to standard error and is more useful when captured alongside the command's exit status.

6. Diagnose failures without changing system state

First confirm that the input exists and is readable:

$ ls -l -- /path/to/image.ppm
$ test -r /path/to/image.ppm && echo readable
readable

Then check the Netpbm header with file or another reader. A file that merely ends in .ppm is not necessarily valid Netpbm data. If a converter writes binary output, do not inspect the whole file with a terminal or text editor.

If the terminal reports that it cannot open the display, check that the command is running in the intended graphical session and that X authentication permits this user. Running sudo pamx is usually the wrong repair: it changes the user credentials while often losing the original display authentication. Elevated privileges are not required to display a readable image.

If an image is too large, use -geometry or -fullscreen, depending on whether you want a bounded window or the whole screen. Neither option transforms the image. Use a separate Netpbm converter when you need a resized copy, and keep the original until the result has been checked.

Done means

  • pamx and the Netpbm package version were checked without root access.
  • The input was confirmed as readable Netpbm data and remained unchanged.
  • A file or pipeline opened in the intended X display, and you know to press q or Ctrl-C to exit.
  • You understand that stdin streams show only their first image.
  • Window sizing, fullscreen mode and colormap options were treated as per-process choices, not persistent configuration.
  • Display failures were separated from input errors before considering any system-level change.