Index: /branches/eam_branch_20080413/psphot/src/pmFootprint.h
===================================================================
--- /branches/eam_branch_20080413/psphot/src/pmFootprint.h	(revision 17458)
+++ /branches/eam_branch_20080413/psphot/src/pmFootprint.h	(revision 17459)
@@ -47,5 +47,5 @@
 
 psImage *pmSetFootprintArrayIDs(const psArray *footprints, const bool relativeIDs);
-psImage *pmSetFootprintID(const pmFootprint *fp, const int id);
+psImage *pmSetFootprintID(psImage *idImage, const pmFootprint *fp, const int id);
 void pmSetFootprintArrayIDsForImage(psImage *idImage,
 				    const psArray *footprints, // the footprints to insert
Index: /branches/eam_branch_20080413/psphot/src/pmFootprintIDs.c
===================================================================
--- /branches/eam_branch_20080413/psphot/src/pmFootprintIDs.c	(revision 17458)
+++ /branches/eam_branch_20080413/psphot/src/pmFootprintIDs.c	(revision 17459)
@@ -74,5 +74,6 @@
  * Set an image to the value of footprint's ID whever they may fall
  */
-psImage *pmSetFootprintID(const pmFootprint *fp, // the footprint to insert
+psImage *pmSetFootprintID(psImage *idImage,
+			  const pmFootprint *fp, // the footprint to insert
 			  const int id) {	// the desired ID
    assert(fp != NULL && pmFootprintTest((const psPtr)fp));
@@ -83,5 +84,11 @@
    assert (numCols >= 0 && numRows >= 0);
    
-   psImage *idImage = psImageAlloc(numCols, numRows, PS_TYPE_S32);
+   if (idImage == NULL) {
+       idImage = psImageAlloc(numCols, numRows, PS_TYPE_S32);
+   } else {
+       assert (idImage->numCols == numCols);
+       assert (idImage->numRows == numRows);
+       // XXX assert on type (S32)
+   }
    P_PSIMAGE_SET_ROW0(idImage, row0);
    P_PSIMAGE_SET_COL0(idImage, col0);
