Index: trunk/psModules/src/camera/pmFPARead.c
===================================================================
--- trunk/psModules/src/camera/pmFPARead.c	(revision 42966)
+++ trunk/psModules/src/camera/pmFPARead.c	(revision 42980)
@@ -194,4 +194,86 @@
 
     return naxis3;
+}
+
+bool applyBLANKifIntType (psImage *output, psImage *input, psMetadata *header) {
+
+  // if the input image is an integer type, then the psFitsReadImage
+  // did not interpret the image being read as a float-equivalent.
+  // In that case, it does not apply the BLANK value because it is 
+  // returning an integer image.  however, if we convert this image to a
+  // float type, we need to fix BLANK values.  we can only do that if
+  // there is a valid header with the keyword BLANK. 
+  
+  if (!output) return false; // no valid input image, do not attempt
+  psElemType outDatatype = output->type.type;
+
+  bool floatOutput = false;
+  floatOutput = floatOutput || (outDatatype == PS_TYPE_F32);
+  floatOutput = floatOutput || (outDatatype == PS_TYPE_F64);
+  if (!floatOutput) return false;
+
+  if (!input) return false; // no valid input image, do not attempt
+  psElemType inDatatype = input->type.type;
+
+  if (inDatatype == PS_TYPE_F32) return false; // not an INT type, skip
+  if (inDatatype == PS_TYPE_F64) return false; // not an INT type, skip
+
+  if (!header) return false; // no header, no info on 'blank', do not attempt
+
+  bool mdstat;
+  int blankValue = psMetadataLookupS32 (&mdstat, header, "BLANK");
+  if (!mdstat) return false; // no BLANK value, do not attempt
+
+  int numRows = input->numRows;
+  int numCols = input->numCols;
+
+# define APPLY_BLANK_TO_OUTPUT(IN,INTYPE,OUT,OUTTYPE) {	\
+    ps##INTYPE *in;					\
+    ps##OUTTYPE *out;					\
+    for (int row = 0; row < numRows; row++) {		\
+      in = IN->data.INTYPE[row];			\
+      out = OUT->data.OUTTYPE[row];			\
+      for (int col = 0; col < numCols; col++) {		\
+	if (*in == blankValue) { *out = NAN; }		\
+	out++; in++;					\
+      }							\
+    }							\
+  }
+
+  switch (outDatatype) {
+    case PS_TYPE_F32:
+      switch (inDatatype) {
+	case PS_TYPE_U8:  APPLY_BLANK_TO_OUTPUT(input, U8,  output, F32); break;
+	case PS_TYPE_U16: APPLY_BLANK_TO_OUTPUT(input, U16, output, F32); break;
+	case PS_TYPE_U32: APPLY_BLANK_TO_OUTPUT(input, U32, output, F32); break;
+	case PS_TYPE_U64: APPLY_BLANK_TO_OUTPUT(input, U64, output, F32); break;
+	case PS_TYPE_S8:  APPLY_BLANK_TO_OUTPUT(input, S8,  output, F32); break;
+	case PS_TYPE_S16: APPLY_BLANK_TO_OUTPUT(input, S16, output, F32); break;
+	case PS_TYPE_S32: APPLY_BLANK_TO_OUTPUT(input, S32, output, F32); break;
+	case PS_TYPE_S64: APPLY_BLANK_TO_OUTPUT(input, S64, output, F32); break;
+	default:
+	  break;
+      }
+    case PS_TYPE_F64:
+      switch (inDatatype) {
+	case PS_TYPE_U8:
+	  APPLY_BLANK_TO_OUTPUT(input, U8,  output, F64);
+	  break;
+	case PS_TYPE_U16:
+	  APPLY_BLANK_TO_OUTPUT(input, U16, output, F64);
+	  break;
+	case PS_TYPE_U32:
+	  APPLY_BLANK_TO_OUTPUT(input, U32, output, F64);
+	  break;
+	case PS_TYPE_U64:
+	  APPLY_BLANK_TO_OUTPUT(input, U64, output, F64);
+	  break;
+	default:
+	  break;
+      }
+    default:
+      break;
+    }
+  return true;
 }
 
@@ -754,4 +836,9 @@
         if (source->type.type != imageType) {
             psImage *temp = psImageCopy(NULL, source, imageType); // Temporary image
+
+	    // if the input image is an integer type, then the BLANK value was not applied by psImageRead
+	    // if we are converting to a floating point type, then we need to set BLANK values to NAN (if it exists)
+	    applyBLANKifIntType (temp, source, hdu->header);
+
             psFree(imageArray->data[i]);
             imageArray->data[i] = temp;
