Index: trunk/ppStack/src/ppStackReadout.c
===================================================================
--- trunk/ppStack/src/ppStackReadout.c	(revision 16682)
+++ trunk/ppStack/src/ppStackReadout.c	(revision 16686)
@@ -14,4 +14,5 @@
 #define REJECTION_FILES                 // Write rejection mask?
 #define INSPECTION_FILES                // Write inspection mask?
+#define COMBINED_FILES                  // Write combined images?
 
 static int sectionNum = 0;              // Section number; for debugging outputs
@@ -39,4 +40,7 @@
     bool useVariance = psMetadataLookupBool(&mdok, config->arguments, "VARIANCE"); // Use variance for rejection?
     bool safe = psMetadataLookupBool(&mdok, config->arguments, "SAFE"); // Play safe when combining small numbers of pixels?
+    psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe
+    int kernelSize = psMetadataLookupS32(NULL, ppsub, "KERNEL.SIZE"); // Kernel half-size
+
 
     int num = readouts->n;              // Number of inputs
@@ -109,5 +113,5 @@
     }
 
-    if (!pmStackCombine(outRO, stack, maskBad, maskBlank, iter, combineRej, useVariance, safe)) {
+    if (!pmStackCombine(outRO, stack, maskBad, maskBlank, kernelSize, iter, combineRej, useVariance, safe)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts with rejection.");
         psFree(fpaList);
@@ -117,14 +121,15 @@
     }
 
+#ifdef COMBINED_FILES
+    {
+        psString name = NULL;           // Name of image
+        psStringAppend(&name, "combined1_%03d.fits", sectionNum);
+        psFits *fits = psFitsOpen(name, "w");
+        psFree(name);
+        psFitsWriteImage(fits, NULL, outRO->image, 0, NULL);
+        psFitsClose(fits);
+    }
+#endif
 #ifdef INSPECTION_FILES
-    {
-        psString name = NULL;           // Name of image
-        psStringAppend(&name, "combined_%03d.fits", sectionNum);
-        psFits *fits = psFitsOpen(name, "w");
-        psFree(name);
-        psFitsWriteImage(fits, NULL, outRO->image, 0, NULL);
-        psFitsClose(fits);
-    }
-
     for (int i = 0; i < stack->n; i++) {
         pmStackData *data = stack->data[i]; // Data for this image
@@ -178,5 +183,5 @@
 #endif
 
-    if (!pmStackCombine(outRO, stack, maskBad, maskBlank, 0, combineRej, useVariance, false)) {
+    if (!pmStackCombine(outRO, stack, maskBad, maskBlank, kernelSize, 0, combineRej, useVariance, false)) {
         psError(PS_ERR_UNKNOWN, false, "Unable to combine input readouts.");
         psFree(fpaList);
@@ -186,4 +191,15 @@
     }
 
+#ifdef COMBINED_FILES
+    {
+        psString name = NULL;           // Name of image
+        psStringAppend(&name, "combined2_%03d.fits", sectionNum);
+        psFits *fits = psFitsOpen(name, "w");
+        psFree(name);
+        psFitsWriteImage(fits, NULL, outRO->image, 0, NULL);
+        psFitsClose(fits);
+    }
+#endif
+
     psMetadataAddF32(outCell->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE,
                      "Summed exposure time (sec)", totExposure);
