Home / Alt manpages / ppmfade(1)

  • ppmfade(1)
  • User command
  • linux

Create 30-Frame PPM Transitions with ppmfade

ppmfade turns two still images into a 30-frame transition, one PPM file per frame. This guide fades between two images, fades from and to black, picks an effect, and checks the frames it produced. Feed the result into whatever tool you use to build a video or animation. Allow about ten minutes for a first run, plus time for writing 30 files to disk.

Before you start

You need a Linux system with Netpbm installed, two readable images in PPM format, and enough free space for 30 output files. This was checked with the Debian package netpbm 2:11.05.02-1.1build1, providing Netpbm 11.5.2. The command needs no elevated privileges when you work in a directory you own.

  • ppmfade writes PPM frames, not a video file. A separate tool turns those frames into a movie later; that is not this command's job.
  • Only PPM goes in. If your source is JPEG, PNG or anything else, convert it to PPM first with a suitable Netpbm converter or image tool.

1. Check the command and prepare a workspace

Check that the installed command is the one you expect, then create a private working directory. The name below is an example; replace it with a path that suits your project:

ppmfade -h
mkdir -p "$HOME/ppmfade-work"
cd "$HOME/ppmfade-work"

The installed command has no real help screen behind -h; it reports its recognised options instead. A successful check lists -f, -l, -base, the effect options, and -mix. The mkdir and cd commands only touch your own workspace.

2. Confirm the input images

Put the two source files in the workspace, or use their existing absolute paths. Both inputs should have the same dimensions. The command reads PPM and reports the dimensions when it starts:

ls -l first.ppm last.ppm
ppmfade -f first.ppm -l last.ppm -base check-only

Warning

That second command is a real generation run, not a dry check. Use a throwaway base name like check-only if all you want is to confirm the inputs, since existing files with the same generated names may be replaced.

Expect something like Frames are 1920W x 1080H, then Creating Frame 1 of 30... through frame 30. It writes check-only.0001.ppm to check-only.0030.ppm in the current directory. If you need to abandon this test, remove only those test files:

rm -- check-only.????.ppm

Warning

Review the glob before pressing Enter. This removal is irreversible unless you have a backup.

Checkpoint: the basic sequence

Checkpoint

At this point you should have exactly 30 numbered files. Check them before moving on:

find . -maxdepth 1 -type f -name 'check-only.????.ppm' | sort | wc -l
sed -n '1,3p' check-only.0001.ppm

The count should read 30. A binary PPM normally begins with P6; an ASCII PPM begins with P3, and the generated frames can be binary even when an input file was written as ASCII. The first frame should show the dimensions and maximum value you expect from the input.

3. Generate the transition you actually want

Once the input check is done, choose a fresh output base. This example uses the default spread transition:

ppmfade -f first.ppm -l last.ppm -base transition

The default effect is -spread: pixels from the first image move away from their original positions, then move into their positions in the final image. The result is transition.0001.ppm through transition.0030.ppm, frame 1 being the start of the transition and frame 30 the end.

Use a base name with a directory when the sequence should land somewhere else:

mkdir -p output
ppmfade -f first.ppm -l last.ppm -base output/transition
find output -maxdepth 1 -type f -name 'transition.????.ppm' | sort | tail -n 1

That last command should print output/transition.0030.ppm. The -base value forms the start of every output filename; it is not a directory option on its own, so create the directory first.

4. Choose an effect when spread is not right

Pass one effect option on the command line. These are the effects the installed manpage documents:

  • -mix superimposes the images, reducing the first and increasing the second. The brightness change is quadratic.
  • -shift moves pixels horizontally before bringing them into their final positions.
  • -relief passes through Laplacian relief versions of the images.
  • -oil passes through oil-transfer versions of the images.
  • -edge passes through edge-detected versions of the images.
  • -bentley applies the documented Bentley Effect between the two images.
  • -block defocuses the first image into small blocks, matches the second image, then focuses it.

For example, create a mix transition under a different base:

ppmfade -f first.ppm -l last.ppm -mix -base mix-transition

Treat the effect options as alternatives, not a chain: combining several does not give you several effects layered together.

5. Fade from or to black

Omit one input to use black at that end. For black to an image, provide only -l:

ppmfade -l last.ppm -base from-black

For an image to black, provide only -f:

ppmfade -f first.ppm -base to-black

Either command still creates frames 0001 through 0030. Supplying both -f and -l makes a transition between those two images. Supplying neither is not a shortcut worth trying: there is no source image to define the sequence.

Common traps and recovery

A missing input, an unreadable file, wrong PPM content or a path typo will stop the run. Read the first error before changing options.

  • Check paths with ls -l and inspect the header with sed -n '1,3p' file.ppm.
  • Check dimensions. If the two images differ in size, make matching-sized inputs before trying again; the manpage says the two images should be the same size.
  • Watch for base-name collisions. Unexpected files in the output directory usually mean a reused base name, not a bug. Stop and inspect the names rather than deleting a broad wildcard.

To undo a run, remove only the exact 30-file sequence you created, or move it to an archive directory first:

mkdir -p archive
mv -- transition.????.ppm archive/

No service is restarted and no system configuration is changed by any of this. sudo is unnecessary unless your chosen directory genuinely is not writable by your user; prefer a user-owned workspace over granting the command extra privileges.

Done means

  • Matching inputs ready. Two readable PPM inputs with matching dimensions, or a deliberate black endpoint.
  • Fresh base name chosen. A new -base value and one transition effect, selected on purpose.
  • Clean run. The command reported frames 1 to 30 without an error.
  • Full sequence confirmed. The output directory contains exactly 30 numbered .ppm frames.
  • Spot-checked the ends. The first and last files have the expected dimensions and open cleanly in your next tool.