about summary refs log tree commit diff
path: root/editor
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-28 19:29:13 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-09-28 19:29:13 +0000
commit2b499210eb2a64c95e6891a8d361b38a8502e063 (patch)
treeed9c1b21fb54e950790a158476513cfa5d368860 /editor
parentbafee11c8c3763c5ea2c9c1365f63c321062b25e (diff)
downloadnetpbm-mirror-2b499210eb2a64c95e6891a8d361b38a8502e063.tar.gz
netpbm-mirror-2b499210eb2a64c95e6891a8d361b38a8502e063.tar.xz
netpbm-mirror-2b499210eb2a64c95e6891a8d361b38a8502e063.zip
Release 10.87.03
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3689 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rwxr-xr-xeditor/pnmquant20
1 files changed, 16 insertions, 4 deletions
diff --git a/editor/pnmquant b/editor/pnmquant
index 0bb328d2..80d8e09f 100755
--- a/editor/pnmquant
+++ b/editor/pnmquant
@@ -199,10 +199,10 @@ sub openSeekableAsStdin($) {
 
 
 
-sub makeColormap($$$$$) {
+sub makeColormap($$$$$$) {
 
-    my ($ncolors, $opt_meanpixel, $opt_meancolor, $opt_spreadluminosity,
-        $opt_quiet) = @_;
+    my ($ncolors, $opt_center, $opt_meanpixel, $opt_meancolor,
+        $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.
@@ -214,8 +214,19 @@ sub makeColormap($$$$$) {
               "errno = $ERRNO\n");
         exit(1);
     }
-
+       
     my $averageOpt;
+
+    my $colorSummaryOptCt =
+        (defined($opt_meanpixel) ? 1 : 0) +
+        (defined($opt_meancolor) ? 1 : 0) +
+        (defined($opt_center)    ? 1 : 0);
+
+    if ($colorSummaryOptCt > 1) {
+        print(STDERR "You can specify only one of " .
+              "-meanpixel, -meancolor, and -center\n");
+        exit(1);
+    }
     if (defined($opt_meanpixel)) {
         $averageOpt = "-meanpixel";
     } elsif (defined($opt_meancolor)) {
@@ -308,6 +319,7 @@ select(OLDOUT);  # avoids Perl bug where it says we never use OLDOUT
 
 
 my $mapfileSpec = makeColormap($cmdlineR->{ncolors}, 
+                               $cmdlineR->{center}, 
                                $cmdlineR->{meanpixel}, 
                                $cmdlineR->{meancolor}, 
                                $cmdlineR->{spreadluminosity},