Index: trunk/ppSub/src/ppSubReadout.c
===================================================================
--- trunk/ppSub/src/ppSubReadout.c	(revision 15448)
+++ trunk/ppSub/src/ppSubReadout.c	(revision 15817)
@@ -60,4 +60,11 @@
     float optThresh = psMetadataLookupF32(&mdok, config->arguments, "OPTIMUM.TOL"); // Tolerance for search
     int optOrder = psMetadataLookupS32(&mdok, config->arguments, "OPTIMUM.ORDER"); // Order for search
+    bool dual = psMetadataLookupBool(&mdok, config->arguments, "DUAL"); // Dual convolution?
+
+    pmSubtractionMode mode = dual ? PM_SUBTRACTION_MODE_DUAL : PM_SUBTRACTION_MODE_UNSURE; // Subtraction mode
+    pmReadout *conv2 = NULL;            // Convolved image, for dual convolution
+    if (dual) {
+        conv2 = pmReadoutAlloc(NULL);
+    }
 
     // Generate masks if they don't exist
@@ -90,9 +97,10 @@
     }
 
-    if (!pmSubtractionMatch(outRO, inRO, refRO, footprint, regionSize, spacing, threshold, sources,
+    if (!pmSubtractionMatch(outRO, conv2, inRO, refRO, footprint, regionSize, spacing, threshold, sources,
                             stampsName, type, size, order, widths, orders, inner, ringsOrder,
                             binning, optimum, optWidths, optOrder, optThresh, iter, rej, maskBad,
-                            maskBlank, badFrac, PM_SUBTRACTION_MODE_UNSURE)) {
+                            maskBlank, badFrac, mode)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
+        psFree(conv2);
         psFree(outRO);
         return false;
@@ -106,5 +114,4 @@
                      "Subtraction kernel", kernels->description);
 
-
     psImage *kernelImage = psMetadataLookupPtr(NULL, outRO->analysis,
                                                "SUBTRACTION.KERNEL.IMAGE"); // Image of the kernels
@@ -114,12 +121,27 @@
 
     // Do the subtraction
-    if (reverse) {
-        psBinaryOp(outRO->image, outRO->image, "-", inRO->image);
-    } else {
-        psBinaryOp(outRO->image, inRO->image, "-", outRO->image);
-    }
-    psBinaryOp(outRO->mask, outRO->mask, "|", inRO->mask);
-    if (outRO->weight) {
-        psBinaryOp(outRO->weight, outRO->weight, "+", inRO->weight);
+    {
+        // Subtraction is: minuend - subtrahend
+        psImage *minuendImage = outRO->image;
+        psImage *subtrahendImage = (dual ? conv2->image : inRO->image);
+        psImage *minuendWeight = outRO->image;
+        psImage *subtrahendWeight = (dual ? conv2->weight : inRO->weight);
+        psImage *mask2 = (dual ? conv2->mask : inRO->mask);
+
+        if (reverse) {
+            psImage *temp = subtrahendImage;
+            subtrahendImage = minuendImage;
+            minuendImage = temp;
+
+            temp = subtrahendWeight;
+            subtrahendWeight = minuendWeight;
+            minuendWeight = temp;
+        }
+
+        psBinaryOp(outRO->image, minuendImage, "-", subtrahendImage);
+        psBinaryOp(outRO->mask, outRO->mask, "|", mask2);
+        if (minuendWeight && subtrahendWeight) {
+            psBinaryOp(outRO->weight, minuendWeight, "+", subtrahendWeight);
+        }
     }
 
