Index: trunk/psphot/src/pmFootprintIDs.c
===================================================================
--- trunk/psphot/src/pmFootprintIDs.c	(revision 17443)
+++ trunk/psphot/src/pmFootprintIDs.c	(revision 17516)
@@ -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);
