/usr/bin/ppmrainbow is in netpbm 2:10.0-15.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/usr/bin/perl -wl
#
# written by Arjen Bax
#
# Contributed to the public domain. This software is provided in
# the hope that it will be useful, but without warranty.
use strict;
use Getopt::Long;
use File::Temp "tempdir";
my ($FALSE, $TRUE) = (0,1);
(my $myname = $0) =~ s#\A.*/##;
my ($Twid, $Thgt, $tmpdir, $verbose);
# set defaults
$Twid = 600;
$Thgt = 8;
$verbose = $FALSE;
(my $usage = <<EOD ) =~ s/^\t//mg;
Usage: $myname [ options ] color ...
Creates a color bar with smoothly changing colors.
Options:
-width width of the color bar (default $Twid)
-height height of the color bar (default $Thgt)
-tmpdir working directory (default envar TMPDIR or \/tmp)
-verbose echo shell commands to STDERR
EOD
GetOptions("width=i" => \$Twid,
"height=i" => \$Thgt,
"tmpdir=s" => \$tmpdir,
"verbose!" => \$verbose);
die "invalid width and/or height\n" unless $Twid >= 1 && $Thgt >= 1;
my $verboseCommand = $verbose ? "set -x;" : "";
if (@ARGV < 1) {
die("You must specify at least one color as an argument");
}
my $numcol = scalar @ARGV;
push @ARGV, $ARGV[0];
my $tempdir = tempdir("$myname.XXXXXXX", CLEANUP => 1)
|| die "Cant create tmpdir"; #219019
my @outlist = ();
my $n = 0;
while (@ARGV >= 2) {
push @outlist, my $outfile = sprintf "%s/%03u.ppm", $tmpdir, $n;
my $w = int(($Twid-1)/$numcol)+1;
0 == system qq{$verboseCommand pgmramp -lr $w $Thgt | pgmtoppm "$ARGV[0]-$ARGV[1]" >$outfile}
or exit 1;
$Twid -= $w;
$numcol--;
$n++;
shift @ARGV;
}
0 == system qq{$verboseCommand pnmcat -lr @outlist}
or exit 1;
exit 0;
# no need to delete anything, as this is automatically done via tempdir
|