pammixmulti - blend together multiple PAM images
pammixmulti [-blend=average|alpha-weighted|random|mask] [-maskfile=filename] [-stdev=number] [-randomseed integer] filename ...
Minimum unique abbreviation of an option is acceptable. You can use double hyphen instead of a single hyphen to denote options. You can use white space in place of the equals sign to separate an option name from its value.
This file is part of Netpbm.
pammixmulti mixes two or more images to produce a new image. The program provides multiple ways to interpret "mix."
In addition to the options common to all programs based on libnetpbm (most notably -quiet, see Common Options), pammixmulti recognizes the following command line options:
This option specifies how the input images should be mixed to produce the output image.
With -blend=average (the default), each pixel in the
output is produced by averaging the corresponding pixels from all the input
images.
With -blend=alpha-weighted, each pixel in the output
is produced by taking a weighted average of the corresponding pixels
from all the input images, using each pixel's alpha (opaqueness) level
as its weight.
With -blend=random, each pixel in the output is
produced by selecting the corresponding pixel from one of the input images,
chosen at random on a per-pixel basis.
With -blend=mask, each pixel in the output is a linear
combination of the corresponding pixel from all the input images, with the
distribution being Gaussian. The mean of that Gaussian distribution, for any
given pixel, is given by the value at the corresponding location in the mask
image identified by the -maskfile option. For example, consider the
output pixel at Row 5, Column 2, with 10 input images. It is a mix of the
pixels at Row 5, Column 2 of all 10 input images, in the following amounts.
Assume -maskfile identifies a single-plane PAM image with maxval 9 and
the value 3 at Row 5, Column 2. Because the maxval is the same as the maximum
input file number, the sample values in the mask image directly identify an
input file. The mask value 3 means input file 3 contributes the most to the
output pixel, with input files 2 and 4 contributing next most, 1 and 5 next
most, etc. in Gaussian distribution. However, the Gaussian distribution is
computed by random sampling so that the precise weighting can vary randomly
from this ideal. The distribution is identical for each mask value, though.
The weights for every pixel with a corresponding mask value of 3 are the same.
-alpha-weighted was new in Netpbm 11.09 (December 2024).
In conjunction with -blend=mask, this option names a
PAM mask file to control the blending of each pixel. The first plane of this
PAM image is the mask; other planes are ignored. The mask value at each
location is the fraction that the sample there is of the mask image's
maxval (so it's range is 0..1).
When used with -blend=mask, this option controls how
smoothly the various input images are mixed to produce each output pixel. For
example, consider running pammixmulti with three input images and a
mask image that uses gray levels from 0 to 255. Given -stdev=0.0, gray
levels 0-84 produce exclusively image 1; gray levels 85-170 produce
exclusively image 2; and gray levels 171-255 produce exclusively image 3. If
the argument to -stdev is positive, images are blended according to a
normal distribution. Hence, gray levels around 85 produce an output pixel
that includes roughly equal amounts of the corresponding pixel from images 1
and 2 but less of the corresponding pixel from image 3. As number
tends towards the number of input images (going beyond that has diminishing
impact), the output tends to look more
like -blend=average. number defaults to 0.25.
Use this to ensure you get the same image on separate invocations.
You supply the names of the files to mix as non-option arguments.
Average a bunch of PPM images to produce a new PAM image:
pammixmulti input*.ppm >output.ppm
Mix these same images by taking each pixel from a randomly selected input image:
pammixmulti -blend=random input*.ppm >output.ppm
Use a mask image to control the fading among input images on a pixel-by-pixel basis:
pammixmulti -blend=mask -maskfile=mask.pgm >output.pam \
one.pam two.pam three.pam four.pam
Do the same but with more abrupt transitions:
pammixmulti -blend=mask -maskfile=mask.pgm -stdev=0.0 >output.pam \
one.pam two.pam three.pam four.pam
and now with more gradual transitions:
pammixmulti -blend=mask -maskfile=mask.pgm -stdev=1.0 >output.pam \
one.pam two.pam three.pam four.pam
pammixmulti was new in Netpbm 10.85 (December 2018).
Copyright 2018–2024 Scott Pakin, scott+pbm@pakin.org.
pamcomp, ppmmix, pamarith, pnm, pam