I have a problem with saving an image using the LibTIFF library. 

In my code I have an array of floats representing the pixel values of the image. When I save these values to a RAW file, it looks fine. However, when I try to save it as a TIFF file using the LibTIFF library, the image looks perfectly fine when I open it in ImageJ, however when I open it in Photoshop or Windows, it looks strange (look below), and Gimp shows a completely transparent image (like there was no data in the image at all).

I use ImageJ to open the RAW file, image type is set to 32bit - Real and Little-endian byte order is ticked.

![RAW on the left, TIFF on the right](https://i.stack.imgur.com/gHKI6.jpg)

Here's the code I use to save the TIFF image:

```
TIFF *tif= TIFFOpen(name, "w");

TIFFSetField (tif, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField (tif, TIFFTAG_IMAGELENGTH, height);
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField (tif, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField (tif, TIFFTAG_ROWSPERSTRIP, 1);
TIFFSetField (tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
TIFFSetField (tif, TIFFTAG_BITSPERSAMPLE, 32);
TIFFSetField (tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);

tsize_t strip_size = TIFFStripSize (tif);
tstrip_t strips_num = TIFFNumberOfStrips (tif); 

float* strip_buf=(float*)_TIFFmalloc(strip_size);
for (unsigned int s=0; s<strips_num; s++) {
    for (unsigned int col=0; col<width; col++) {
        strip_buf[col]=image[s][col];
    }
    TIFFWriteEncodedStrip (tif, s, strip_buf, strip_size);

}
_TIFFfree(strip_buf);
TIFFClose(tif);

```

I'm pretty sure something's wrong with the way I'm saving the file - but I have no idea what. Thanks a lot for your help!