Index: trunk/ppImage/src/ppImageDetrendReadout.c
===================================================================
--- trunk/ppImage/src/ppImageDetrendReadout.c	(revision 10288)
+++ trunk/ppImage/src/ppImageDetrendReadout.c	(revision 10322)
@@ -15,10 +15,4 @@
     // find the currently selected readout
     pmReadout *input = pmFPAfileThisReadout(config->files, view, "PPIMAGE.INPUT");
-
-    // apply the externally supplied mask to the input->mask pixels
-    if (options->doMask) {
-        pmReadout *mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.MASK");
-        pmMaskBadPixels(input, mask, options->maskValue);
-    }
 
 # if 0
@@ -46,6 +40,14 @@
     }
 
-    // create the target mask and weight images
-    pmReadoutGenerateMaskWeight(input, true);
+    if (options->doMask || options->doShutter || options->doFlat || options->doPhotom) {
+        // create the target mask and weight images
+        pmReadoutGenerateMaskWeight(input, true);
+    }
+
+    // apply the externally supplied mask to the input->mask pixels
+    if (options->doMask) {
+        pmReadout *mask = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.MASK");
+        pmMaskBadPixels(input, mask, options->maskValue);
+    }
 
     // Shutter correction
