Index: trunk/magic/remove/src/streaksio.c
===================================================================
--- trunk/magic/remove/src/streaksio.c	(revision 26407)
+++ trunk/magic/remove/src/streaksio.c	(revision 26408)
@@ -1182,6 +1182,10 @@
 
 void
-strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask)
-{
+strkGetMaskValues(streakFiles *sfiles)
+{
+    if (sfiles->maskStreak) {
+        // already done
+        return;
+    }
     if (sfiles->inMask && sfiles->inMask->header) {
         if (!pmConfigMaskReadHeader(sfiles->config, sfiles->inMask->header)) {
@@ -1196,5 +1200,5 @@
         streaksExit("", PS_EXIT_CONFIG_ERROR);
     }
-    *maskStreak = psMetadataLookupU32(&status, masks, "STREAK");
+    sfiles->maskStreak = psMetadataLookupU32(&status, masks, "STREAK");
     if (!status) {
         psError(PM_ERR_CONFIG, false, "failed to lookup mask value for STREAK in recipes\n");
@@ -1212,5 +1216,5 @@
         }
     }
-    *maskMask = ~convPoor;
+    sfiles->maskMask = ~convPoor;
 }
 
Index: trunk/magic/remove/src/streaksio.h
===================================================================
--- trunk/magic/remove/src/streaksio.h	(revision 26407)
+++ trunk/magic/remove/src/streaksio.h	(revision 26408)
@@ -16,5 +16,5 @@
 void copyFitsOptions(sFile *out, sFile *rec, sFile *in, psVector *tiles);
 void setupImageRefs(sFile *out, sFile *recoveryOut, sFile *in, int extnum, bool exciseAll);
-void strkGetMaskValues(streakFiles *sfiles, psU32 *maskStreak, psU32 *maskMask);
+void strkGetMaskValues(streakFiles *sfiles);
 void copyExtraExtensions(streakFiles *sfiles);
 
Index: trunk/magic/remove/src/streaksrelease.c
===================================================================
--- trunk/magic/remove/src/streaksrelease.c	(revision 26407)
+++ trunk/magic/remove/src/streaksrelease.c	(revision 26408)
@@ -16,8 +16,4 @@
         return PS_EXIT_CONFIG_ERROR;
     }
-
-    // Values to set for masked pixels
-    psU32 maskStreak = 0;           // for the image and weight (usually NAN, MAXINT for integer images)
-    psU32 maskMask = 0;             // value looked up for MASK.STREAK
 
     // Does true work here?
@@ -50,9 +46,7 @@
 
         // now that we've read the input files, lookup the mask values that we read
-        if (maskStreak == 0) {
-            strkGetMaskValues(sfiles, &maskStreak, &maskMask);
-        }
-
-        setMaskedToNAN(sfiles, maskMask, true);
+        strkGetMaskValues(sfiles);
+
+        setMaskedToNAN(sfiles, sfiles->maskMask, true);
 
         // write out the destreaked temporary images and the recovery images
Index: trunk/magic/remove/src/streaksremove.c
===================================================================
--- trunk/magic/remove/src/streaksremove.c	(revision 26407)
+++ trunk/magic/remove/src/streaksremove.c	(revision 26408)
@@ -34,8 +34,4 @@
     }
 
-    // Values to set for masked pixels
-    psU32 maskStreak = 0;           // for the image and weight (usually NAN, MAXINT for integer images)
-    psU32 maskMask = 0;             // value looked up for MASK.STREAK
-
     psString streaksFileName = psMetadataLookupStr(NULL, config->arguments, "STREAKS");
 
@@ -118,7 +114,5 @@
 
         // now that we've read the input files, lookup the mask values
-        if (maskStreak == 0) {
-            strkGetMaskValues(sfiles, &maskStreak, &maskMask);
-        }
+        strkGetMaskValues(sfiles);
 
         totalPixels += sfiles->inImage->numRows * sfiles->inImage->numCols;
@@ -142,5 +136,5 @@
                     // set non-warped pixels and variance to NAN, mask to maskStreak (since the pixel
                     // is excised as part of the destreaking process)
-                    exciseNonWarpedPixels(sfiles, maskStreak);
+                    exciseNonWarpedPixels(sfiles, sfiles->maskStreak);
 
                     psLogMsg("streaksremove", PS_LOG_INFO, "time to excise non warped pixels: %f\n", psTimerClear("EXCISE_NON_WARPED"));
@@ -149,5 +143,5 @@
                 psTimerStart("REMOVE_STREAKS");
 
-                totalStreakPixels += censorPixels(sfiles, pixels, checkNonWarpedPixels, maskStreak);
+                totalStreakPixels += censorPixels(sfiles, pixels, checkNonWarpedPixels, sfiles->maskStreak);
 
                 psLogMsg("streaksremove", PS_LOG_INFO, "time to remove streak pixels: %f\n", psTimerClear("REMOVE_STREAKS"));
@@ -155,5 +149,5 @@
                 if (nanForRelease) {
                     // set any pixels that were masked, to NAN (unless they are already NAN)
-                    setMaskedToNAN(sfiles, maskMask, true);
+                    setMaskedToNAN(sfiles, sfiles->maskMask, true);
                 }
 
@@ -173,5 +167,5 @@
         }
 
-        censorSources(sfiles, maskStreak);
+        censorSources(sfiles, sfiles->maskStreak);
 
         // write the destreaked "temporary" images and the recovery images
@@ -512,4 +506,14 @@
 }
 
+static void 
+setStreakBits(psImage *maskImage, psU32 maskStreak)
+{
+    for (int y=0 ; y < maskImage->numRows; y++) {
+        for (int x=0 ; x < maskImage->numCols; x++) {
+            maskImage->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskStreak;
+        }
+    }
+}
+
 // set the image for the output files to the contents of the corresponding input file.
 static bool
@@ -582,4 +586,9 @@
             // Note: we don't excise the mask pixels even if exciseAll is true.
             setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, false);
+            if (exciseAll) {
+                strkGetMaskValues(sf);
+                
+                setStreakBits(sf->inMask->image, sf->maskStreak);
+            }
             if (sf->outChMask) {
                 sf->outChMask->header = (psMetadata *) psMemIncrRefCounter(sf->outMask->header);
Index: trunk/magic/remove/src/streaksremove.h
===================================================================
--- trunk/magic/remove/src/streaksremove.h	(revision 26407)
+++ trunk/magic/remove/src/streaksremove.h	(revision 26408)
@@ -75,4 +75,6 @@
     double  transparentStreaks;
     psString    program_name;
+    psU32   maskStreak;
+    psU32   maskMask;
 } streakFiles;
 
