about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY4
-rwxr-xr-xeditor/pnmquant15
2 files changed, 17 insertions, 2 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index cde7fbca..7bea53d1 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,6 +6,10 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.82.00
 
+              pnmremap: Add -randomseed.
+
+              pnmquant: Add -norandom, -randomseed.
+
               pamtogif: Add -noclear option.
 
               giftopnm: Check "data width" value from GIF image properly:
diff --git a/editor/pnmquant b/editor/pnmquant
index 340dea78..0bb328d2 100755
--- a/editor/pnmquant
+++ b/editor/pnmquant
@@ -97,6 +97,7 @@ sub parseCommandLine(@) {
                                   "spreadluminosity",
                                   "floyd|fs!",
                                   "norandom",
+                                  "randomseed=i",
                                   "quiet",
                                   "plain");
 
@@ -249,9 +250,10 @@ sub makeColormap($$$$$) {
 
 
 
-sub remap($$$$$) {
+sub remap($$$$$$) {
 
-    my ($mapfileSpec, $opt_floyd, $opt_norandom, $opt_plain, $opt_quiet) = @_;
+    my ($mapfileSpec, $opt_floyd, $opt_norandom, $opt_randomseed,
+        $opt_plain, $opt_quiet) = @_;
 
     # Remap the image on Standard Input to Standard Output, using the colors
     # from the colormap file named $mapfileSpec.
@@ -265,6 +267,14 @@ sub remap($$$$$) {
     if ($opt_norandom) {
         push(@options, "-norandom");
     }
+    if (defined($opt_randomseed)) {
+        if ($opt_randomseed < 0) {
+             print(STDERR "-randomseed value must not be negative.  " .
+                   "You specified $opt_randomseed\n");
+             exit(10);
+        }
+        push(@options, "-randomseed=$opt_randomseed");
+    }
     if ($opt_plain) {
         push(@options, "-plain");
     }
@@ -316,6 +326,7 @@ open(STDOUT, ">&OLDOUT");
 remap($mapfileSpec, 
       $cmdlineR->{floyd}, 
       $cmdlineR->{norandom}, 
+      $cmdlineR->{randomseed}, 
       $cmdlineR->{plain},
       $cmdlineR->{quiet});