Index: trunk/psphot/src/pmFootprint.c
===================================================================
--- trunk/psphot/src/pmFootprint.c	(revision 13349)
+++ trunk/psphot/src/pmFootprint.c	(revision 13351)
@@ -863,4 +863,54 @@
 /************************************************************************************************************/
 /*
+ * Grow a psArray of pmFootprints isotropically by r pixels, returning a new psArray of new pmFootprints
+ */
+psArray *pmGrowFootprintArray(const psArray *footprints, // footprints to grow
+			      int r) {	// how much to grow each footprint
+    assert (footprints->n == 0 || pmIsFootprint(footprints->data[0]));
+
+    if (footprints->n == 0) {		// we don't know the size of the footprint's region
+	return psArrayAlloc(0);
+    }
+    /*
+     * We'll insert the footprints into an image, then convolve with a disk,
+     * then extract a footprint from the result --- this is magically what we want.
+     */
+    psImage *idImage = pmSetFootprintArrayIDs(footprints, true);
+    if (r <= 0) {
+	r = 1;				// r == 1 => no grow
+    }
+    psKernel *circle = psKernelAlloc(-r, r, -r, r);
+    assert (circle->image->numRows == 2*r + 1 && circle->image->numCols == circle->image->numRows);
+    for (int i = 0; i <= r; i++) {
+	for (int j = 0; j <= r; j++) {
+	    if (i*i + j*j <= r*r) {
+		circle->kernel[i][j] = 
+		    circle->kernel[i][-j] = 
+		    circle->kernel[-i][j] = 
+		    circle->kernel[-i][-j] = 1;
+	    }
+	}
+    }
+
+    psImage *grownIdImage = psImageConvolveDirect(idImage, circle);
+    psFree(circle);	
+
+    psArray *grown = pmFindFootprints(grownIdImage, 0.5, 1);
+    assert (grown != NULL);
+    psFree(idImage); psFree(grownIdImage);
+    /*
+     * Now assign the peaks appropriately.  We could do this more efficiently
+     * using idImage (which we just freed), but this is easy and probably fast enough
+     */
+    const psArray *peaks = pmFootprintArrayToPeaks(footprints);
+    pmPeaksAssignToFootprints(grown, peaks);
+    psFree((psArray *)peaks);
+
+    return grown;
+    
+}
+
+/************************************************************************************************************/
+/*
  * Merge together two psArrays of pmFootprints neither of which is damaged.
  *
@@ -911,5 +961,5 @@
     /*
      * Now assign the peaks appropriately.  We could do this more efficiently
-     * using idImage (which we just freed), but this is easy any probably fast enough
+     * using idImage (which we just freed), but this is easy and probably fast enough
      */
     const psArray *peaks;
