Index: trunk/psModules/src/imcombine/pmSubtractionIO.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtractionIO.c	(revision 20354)
+++ trunk/psModules/src/imcombine/pmSubtractionIO.c	(revision 20355)
@@ -39,5 +39,6 @@
 #define NAME_NUMSTAMPS "NUMSTAMPS"      // Number of good stamps
 
-#define EXTNAME "SUBTRACTION_KERNEL"    // Extension name
+#define EXTNAME_KERNEL "SUBTRACTION_KERNEL"    // Extension name for kernel
+#define EXTNAME_IMAGE  "SUBTRACTION_KERNEL_IMAGE"    // Extension name for image
 
 //////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -143,6 +144,6 @@
     // CVS tags, used to identify the version of this file (in case incompatibilities are introduced)
     psString cvsFile = psStringCopy("$RCSfile: pmSubtractionIO.c,v $");
-    psString cvsRev  = psStringCopy("$Revision: 1.8 $");
-    psString cvsDate = psStringCopy("$Date: 2008-10-10 23:54:33 $");
+    psString cvsRev  = psStringCopy("$Revision: 1.9 $");
+    psString cvsDate = psStringCopy("$Date: 2008-10-24 21:21:06 $");
     psStringSubstitute(&cvsFile, NULL, "RCSfile: ");
     psStringSubstitute(&cvsRev,  NULL, "Revision: ");
@@ -158,6 +159,14 @@
     psFree(version);
 
-    if (!psFitsWriteTable(fits, header, rows, EXTNAME)) {
+    if (!psFitsWriteTable(fits, header, rows, EXTNAME_KERNEL)) {
         psError(PS_ERR_IO, false, "Unable to write subtraction kernel to FITS table.");
+        psFree(header);
+        psFree(rows);
+        return false;
+    }
+
+    psImage *image = psMetadataLookupPtr(NULL, ro->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL_IMAGE); // Image
+    if (image && !psFitsWriteImage(fits, header, image, 0, EXTNAME_IMAGE)) {
+        psError(PS_ERR_IO, false, "Unable to write subtraction kernel image.");
         psFree(header);
         psFree(rows);
@@ -248,5 +257,5 @@
     PS_ASSERT_FITS_NON_NULL(fits, false);
 
-    if (!psFitsMoveExtName(fits, EXTNAME)) {
+    if (!psFitsMoveExtName(fits, EXTNAME_KERNEL)) {
         psError(PS_ERR_IO, false, "Unable to move to subtraction kernel table.");
         return false;
