Index: trunk/psLib/src/image/psImage.c
===================================================================
--- trunk/psLib/src/image/psImage.c	(revision 2102)
+++ trunk/psLib/src/image/psImage.c	(revision 2105)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-13 00:10:50 $
+ *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-14 01:22:59 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -441,6 +441,6 @@
         psF64 unexposedValue) \
 { \
-    int intX = (int) round((psF64)(x) - 0.5); \
-    int intY = (int) round((psF64)(y) - 0.5); \
+    int intX = (int) round((psF64)(x) - 0.5 + FLT_EPSILON); \
+    int intY = (int) round((psF64)(y) - 0.5 + FLT_EPSILON); \
     int lastX = input->numCols - 1; \
     int lastY = input->numRows - 1; \
Index: trunk/psLib/src/image/psImage.h
===================================================================
--- trunk/psLib/src/image/psImage.h	(revision 2102)
+++ trunk/psLib/src/image/psImage.h	(revision 2105)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-13 00:10:50 $
+ *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-14 01:22:59 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -31,8 +31,9 @@
  */
 typedef enum {
-    PS_INTERPOLATE_FLAT,               ///< 'flat' interpolation (nearest pixel)
+    PS_INTERPOLATE_FLAT = 1,           ///< 'flat' interpolation (nearest pixel)
     PS_INTERPOLATE_BILINEAR,           ///< bi-linear interpolation
     PS_INTERPOLATE_BICUBIC,            ///< bi-cubic interpolation
-    PS_INTERPOLATE_SINC                ///< sinc interpolation
+    PS_INTERPOLATE_SINC,               ///< sinc interpolation
+    PS_INTERPOLATE_NUM_MODES           ///< end-marker of list of modes; not a valid interpolation mode
 } psImageInterpolateMode;
 
Index: trunk/psLib/src/image/psImageExtraction.c
===================================================================
--- trunk/psLib/src/image/psImageExtraction.c	(revision 2102)
+++ trunk/psLib/src/image/psImageExtraction.c	(revision 2105)
@@ -9,6 +9,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-13 23:34:57 $
+ *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-14 01:22:59 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -543,4 +543,13 @@
     }
 
+    if (mode < PS_INTERPOLATE_FLAT || mode >= PS_INTERPOLATE_NUM_MODES) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
+                   mode);
+        psFree(out);
+        return NULL;
+    }
+
     if (mask != NULL) {
         if (numRows != mask->numRows || numCols != mask->numCols) {
Index: trunk/psLib/src/image/psImageManip.c
===================================================================
--- trunk/psLib/src/image/psImageManip.c	(revision 2102)
+++ trunk/psLib/src/image/psImageManip.c	(revision 2105)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-10-02 02:08:00 $
+ *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-10-14 01:22:59 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -569,4 +569,23 @@
         return NULL;
     }
+
+    if (scale < 1) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_SCALE_NOT_POSITIVE,
+                   scale);
+        psFree(out);
+        return NULL;
+    }
+
+    if (mode < PS_INTERPOLATE_FLAT || mode >= PS_INTERPOLATE_NUM_MODES) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageResample",
+                   PS_ERR_BAD_PARAMETER_VALUE, true,
+                   PS_ERRORTEXT_psImageManip_INTERPOLATION_MODE_UNSUPPORTED,
+                   mode);
+        psFree(out);
+        return NULL;
+    }
+
     // create an output image of the same size
     // and type
@@ -582,5 +601,5 @@
             float inRow = (float)row * invScale; \
             for (int col=0;col<outCols;col++) { \
-                rowData[col] = psImagePixelInterpolate(in,inRow,(float)col*invScale,NULL,0,0,mode); \
+                rowData[col] = psImagePixelInterpolate(in,(float)col*invScale,inRow,NULL,0,0,mode); \
             } \
         }  \
