Server IP : 3.128.248.115 / Your IP : 3.133.152.26 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ip-172-31-33-233 5.15.0-1037-aws #41~20.04.1-Ubuntu SMP Mon May 22 18:18:00 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.28 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /bin/ |
Upload File : |
#!/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