Home / Alt manpages / pnmtofiasco(1)

  • pnmtofiasco(1)
  • User command
  • linux

Compress PNM Images to FIASCO with pnmtofiasco

pnmtofiasco squeezes a PBM, PGM or PPM image into a FIASCO file, an old fractal-compression format that never caught on but still ships in Netpbm. Allow about fifteen minutes for a first conversion, including picking a quality level and decoding the result to prove it actually reads back.

The examples use Netpbm 11.5.2 from package version 2:11.05.02-1.1build1, as installed on this machine. You need the netpbm package, a readable PNM input, and a writable working directory. The conversion normally needs no elevated privileges; do not reach for sudo just because the output happens to be compressed. Use an administrator account only when the input or destination genuinely belongs to a protected directory.

1. Check the installed command

Confirm which executable will run and record its version. Both commands are read-only:

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

The version output includes build details after the Netpbm version; your package revision and build date may differ. The manual page describes this older FIASCO interface, so keep the installed version in mind before moving a command to another host.

Checkpoint

The first command must point to the binary you expect, and the version command must exit successfully. Fix the package or PATH before you touch any image data.

2. Convert one image to a named file

The simplest operation reads one image and writes FIASCO data to standard output. Naming the output with --output-name makes the destination explicit:

$ pnmtofiasco --output-name=photo.wfa /path/to/photo.ppm
  ... progress output ...

The input can be PBM, PGM or PPM. If the name is relative, the installed program normally creates it in the current directory, or it can use the first writable directory in the colon-separated FIASCO_DATA search path.

Check the result before replacing or deleting the source:

$ test -s photo.wfa && file photo.wfa
photo.wfa: data

The exact description from file can vary, and a non-empty file alone is not a full validity check; the decode step later confirms it properly.

Warning

An existing destination may be overwritten without warning. Choose a new filename when the old FIASCO file matters, or back it up before rerunning a conversion. To recover from a failed attempt, keep the original and remove only the incomplete new file once you have checked the command's exit status. Never blindly delete a file that an earlier successful run created.

3. Set quality deliberately

--quality=N takes values from 1 to 100; the default is 20, where 1 is worst and 100 is best. Higher quality usually means a bigger file, but the real trade-off depends on the image, so compare decoded results rather than guessing from the number alone.

$ pnmtofiasco --quality=80 --output-name=photo-q80.wfa /path/to/photo.ppm

Quality is a compression setting, not a resize operation; it never touches the input file. For repeatable scripts, spell out the quality instead of relying on the default, particularly since a later package version might implement it slightly differently.

Checkpoint

Confirm the destination exists and has a plausible size:

$ stat --format='%n %s bytes' photo-q80.wfa
photo-q80.wfa 123456 bytes

4. Make batch input explicit

For a sequence of images, let the shell expand a carefully chosen filename pattern, or use pnmtofiasco's own input template syntax. A shell glob is easier to inspect:

$ pnmtofiasco --quality=80 --output-name=video.wfa /path/to/foo0*.ppm

Quote a path containing spaces, but do not quote the glob itself if you want the shell to expand it. Inspect what the pattern actually matches first:

$ printf '%s\n' /path/to/foo0*.ppm

If the pattern matches nothing, many shells pass it through literally and the converter reports an input error. Stop and fix the filename pattern rather than creating an output from the wrong input. The manual also supports templates such as img0[12-01-2].pgm, describing a numeric sequence; use that form only when its start, end and step are unambiguous to whoever maintains the script next.

5. Silence or adjust progress output

By default the installed command reports progress. For a quiet batch job, set verbosity to zero and disable the progress meter:

$ pnmtofiasco --verbose=0 --progress-meter=0 \
    --quality=80 --output-name=photo.wfa /path/to/photo.ppm
  • --verbose=1 gives a progress meter.
  • --verbose=2 adds detailed compression statistics.
  • The progress meter is selected separately: 0 disables it, 1 uses a hash-mark display, 2 shows percentages.

Avoid parsing the default progress text in automation; use the exit status and an output file check instead.

6. Decode the result and verify it

The matching fiascotopnm command writes a decoded PNM image to standard output. Decode to a separate file so the original input stays available for comparison:

$ fiascotopnm photo-q80.wfa > photo-q80.ppm
$ pnmfile photo-q80.ppm
photo-q80.ppm: PPM raw, 1920 by 1080  maxval 255

Dimensions and maximum sample value should match the source for an ordinary still-image round trip. Lossy compression means pixel values can differ, so visual inspection or an application-specific comparison is still needed. A successful decoder exit status proves the FIASCO file is readable, not that the chosen quality actually suits your use.

If decoding fails, keep both the source and the FIASCO file while you investigate. Confirm the converter finished with a zero exit status, that the destination is not empty, and that --output-name did not accidentally point at a directory you cannot write to. Re-run to a fresh destination rather than overwriting the only copy.

Common traps

pnmtofiasco reads configuration in this order: /etc/system.fiascorc, $HOME/.fiascorc, command-line options, then the file supplied with --config=name, with later settings overriding earlier ones. A command that behaves differently between accounts can be inheriting a personal file:

$ pnmtofiasco --config=/path/to/project.fiascorc \
    --verbose=0 --progress-meter=0 \
    --output-name=photo.wfa /path/to/photo.ppm

Safety boundary

Keep a project configuration readable and review it before use. Do not edit /etc/system.fiascorc or a user's configuration as part of a routine conversion; those are persistent changes that can affect other invocations. If an experiment changed a personal configuration, restore the previous copy, or remove only the specific test setting once you have checked what else the file contains.

Done means

  • Version confirmed: pnmtofiasco --version identifies the intended Netpbm installation.
  • Input and destination checked: a readable PBM, PGM or PPM file, and an output destination chosen deliberately.
  • Conversion succeeded: the command completed and produced a non-empty FIASCO file.
  • Decode confirmed: fiascotopnm decoded that file to a separate PNM file.
  • Result verified: the decoded dimensions were checked, and the source was kept until the result was accepted.