Create 30-frame PPM transitions with ppmfade
By the end of this guide, you will have a numbered sequence of 30 PPM images that transitions from one image to another. You will also know how to fade from black, fade to black, select an effect, and confirm that the files are usable. Allow about 10 minutes for a first run, plus time for writing the frames to disk.
The route
Jump straight to the step you need, or tick off Done means at the end.
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 guide was checked with the Debian package netpbm 2:11.05.02-1.1build1, providing Netpbm 11.5.2. The command does not require elevated privileges when you work in a directory you own.
ppmfade writes PPM frames, not a video file. A later tool can turn those frames into a movie or an animation, but that is a separate step. If you only have JPEG, PNG or another format, 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 directory 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 does not provide a help screen for -h; it reports the recognised options instead. A successful check lists -f, -l, -base, the effect options, and -mix. The mkdir and cd commands change only 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
This second command is a real generation run, so use a temporary base name if you are only checking the inputs. You should see output similar to Frames are 1920W x 1080H, followed by Creating Frame 1 of 30... through frame 30. It creates check-only.0001.ppm to check-only.0030.ppm in the current directory.
Do not use a base name that already belongs to valuable frames. Existing files with the same generated names may be replaced. If you need to abandon this test, remove only those test files, for example:
rm -- check-only.????.ppm
Review the glob before pressing Enter. This removal is irreversible unless you have a backup.
Checkpoint: the basic sequence
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 be 30. A binary PPM normally begins with P6; an ASCII PPM begins with P3. The first frame should have the dimensions and maximum value expected for the input. The generated frames may be binary even when an input file was written as ASCII.
3. Generate the useful transition
Once the input check is complete, choose a fresh output base. This example uses the default spread transition:
ppmfade -f first.ppm -l last.ppm -base transition
The default is -spread. Pixels from the first image move away from their original positions and then move into their positions in the final image. The result is transition.0001.ppm through transition.0030.ppm. Frame 1 is the start of the transition and frame 30 is the end.
Use a base name with a directory when you want the sequence elsewhere:
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
The last command should print output/transition.0030.ppm. The -base value forms the beginning of every output filename; it is not a directory option by itself, 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 documented by the installed manpage:
-mixsuperimposes the images, reducing the first image and increasing the second. Its brightness change is quadratic.-shiftmoves pixels horizontally before bringing them into the final positions.-reliefpasses through Laplacian relief versions of the images.-oilpasses through oil-transfer versions of the images.-edgepasses through edge-detected versions of the images.-bentleyapplies the documented Bentley Effect between the two images.-blockdefocuses 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
Do not combine several effect flags and expect a chain of effects. Treat the effect options as alternatives and select one per run.
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
Each command still creates frames 0001 through 0030. Supplying both -f and -l creates a transition between those images. Supplying neither is not a useful shortcut: there is no source image to define the sequence.
Common traps and recovery
A missing input, 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. If the dimensions differ, create matching-sized inputs before trying again; the manpage says the two images should be the same size.
Unexpected files in the output directory are usually a base-name collision. 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 these commands. sudo is unnecessary unless your chosen input or output directory is not writable by your user. In that case, prefer a user-owned workspace instead of granting the image command extra privileges.
Done means
- You have two readable PPM inputs with matching dimensions, or a deliberate black endpoint.
- You selected a fresh
-baseand one transition effect. - The command reported frames 1 to 30 without an error.
- The output directory contains exactly 30 numbered
.ppmframes. - The first and last files have the expected dimensions and can be opened by your next image or video tool.