Index: trunk/psLib/src/fits/psFitsImage.c
===================================================================
--- trunk/psLib/src/fits/psFitsImage.c	(revision 16665)
+++ trunk/psLib/src/fits/psFitsImage.c	(revision 16672)
@@ -7,6 +7,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-01-23 03:08:03 $
+ *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-02-27 00:35:41 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -285,6 +285,7 @@
             // Choose an appropriate BSCALE and BZERO
             if (!psFitsScaleDetermine(bscale, bzero, image, fits)) {
-                psError(PS_ERR_UNKNOWN, false, "Unable to determine BSCALE and BZERO for image.");
-                return NULL;
+                // We can't have the write dying for this reason --- try to save it somehow!
+                psWarning("Unable to determine BSCALE and BZERO for image --- setting to 1.0, 0.0");
+                psErrorStackClear();
             }
         } else {
Index: trunk/psLib/src/fits/psFitsScale.c
===================================================================
--- trunk/psLib/src/fits/psFitsScale.c	(revision 16665)
+++ trunk/psLib/src/fits/psFitsScale.c	(revision 16672)
@@ -288,12 +288,19 @@
         for (int y = 0; y < numRows; y++) { \
             for (int x = 0; x < numCols; x++) { \
-                ps##INTYPE value = ((IN)->data.INTYPE[y][x] - zero) * scale; \
-                if (options->fuzz) { \
-                   /* Add random factor [0,1): adds a variance of 1/12, */ \
-                   /* but preserves the expectation value */ \
-                    value += psRandomUniform(rng); \
+                ps##INTYPE value = (IN)->data.INTYPE[y][x]; \
+                if (!isfinite(value)) { \
+                    /* This choice of "max" for non-finite pixels is mainly cosmetic --- it has to be */ \
+                    /* something, and "min" would produce holes in the cores of bright stars. */ \
+                    (OUT)->data.OUTTYPE[y][x] = max; \
+                } else { \
+                    value = (value - zero) * scale; \
+                    if (options->fuzz) { \
+                       /* Add random factor [0,1): adds a variance of 1/12, */ \
+                       /* but preserves the expectation value */ \
+                        value += psRandomUniform(rng); \
+                    } \
+                    /* Check for underflow and overflow */ \
+                    (OUT)->data.OUTTYPE[y][x] = (value < min ? min : (value > max ? max : value)); \
                 } \
-                /* Check for underflow and overflow */ \
-                (OUT)->data.OUTTYPE[y][x] = (value < min ? min : (value > max ? max : value)); \
             } \
         } \
