diff options
Diffstat (limited to 'editor/pnmquant')
-rwxr-xr-x | editor/pnmquant | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/editor/pnmquant b/editor/pnmquant index 80d8e09f..f7af9e7a 100755 --- a/editor/pnmquant +++ b/editor/pnmquant @@ -89,7 +89,7 @@ sub parseCommandLine(@) { my %cmdline; - my $validOptions = GetOptions(\%cmdline, + my $optsAreValid = GetOptions(\%cmdline, "center", "meancolor", "meanpixel", @@ -101,7 +101,7 @@ sub parseCommandLine(@) { "quiet", "plain"); - if (!$validOptions) { + if (!$optsAreValid) { print(STDERR "Invalid option syntax.\n"); exit(1); } @@ -199,10 +199,10 @@ sub openSeekableAsStdin($) { -sub makeColormap($$$$$$) { +sub makeColormap($$$$$$$) { my ($ncolors, $opt_center, $opt_meanpixel, $opt_meancolor, - $opt_spreadluminosity, $opt_quiet) = @_; + $opt_spreadbrightness, $opt_spreadluminosity, $opt_quiet) = @_; # Make a colormap of $ncolors colors from the image on Standard Input. # Put it in a temporary file and return its name. @@ -235,6 +235,16 @@ sub makeColormap($$$$$$) { $averageOpt = "-center"; } + my $spreadOptCt = + (defined($opt_spreadluminosity) ? 1 : 0) + + (defined($opt_spreadbrightness) ? 1 : 0); + + if ($spreadOptCt > 1) { + print(STDERR "You can specify only one of " . + "-spreadluminosity and -spreadbrightness\n"); + exit(1); + } + my $spreadOpt; if (defined($opt_spreadluminosity)) { $spreadOpt = "-spreadluminosity"; @@ -276,6 +286,10 @@ sub remap($$$$$$) { push(@options, "-floyd"); } if ($opt_norandom) { + if (defined($opt_randomseed)) { + print(STDERR "You cannot specify -randomseed with -norandom\n"); + exit(1); + } push(@options, "-norandom"); } if (defined($opt_randomseed)) { @@ -322,6 +336,7 @@ my $mapfileSpec = makeColormap($cmdlineR->{ncolors}, $cmdlineR->{center}, $cmdlineR->{meanpixel}, $cmdlineR->{meancolor}, + $cmdlineR->{spreadbrightness}, $cmdlineR->{spreadluminosity}, $cmdlineR->{quiet}); |