<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.28.2">
</HEAD>
<BODY>
Hi all,<BR>
<BR>
I've downloaded image data[1] which has no header and is comprised of 16-bit signed big-endian pixels (it's a heightmap). I figured I'd cull a portion of the data and turn it into a TIFF so I could check it out visually to make sure it looks kinda like a heightmap should. However, I seem to be doing something wrong. I've read the data into a string (not unicode, and the file was opened with 'rb'), and I'm using essentially this code to generate a TIFF:<BR>
<BR>
f = open('data.bin', 'rb')<BR>
data = f.read(&lt;a subset of the file representing, say, Colorado&gt;)<BR>
p = Image.fromstring('F', (tile_width, tile_height), data, 'raw', 'F;16BS', 0, 1)<BR>
p.save('foo.tiff')<BR>
<BR>
I've verified that I'm pulling data that isn't just a bunch of zeros, and I've verified that the generated TIFF isn't just a bunch of zeros, but when I view it I get the checkerboard pattern which seems to indicate a translucent image. Or something.<BR>
<BR>
Part of my confusion comes from the interrelation between the two &quot;mode&quot; arguments to Image.fromstring(). I guess the first one indicates the kind of output mode you want, and the second one indicates the raw decoder to use? But why am I specifying 'F' if the input data is all integers? I tried changing them respectively to 'I' and 'I;16BS', but that didn't change the resulting blank image.<BR>
<BR>
Any tips appreciated!<BR>
<BR>
Thanks,<BR>
<BR>
Steve<BR>
<BR>
[1] <A HREF="http://visibleearth.nasa.gov/view_rec.php?id=8391">http://visibleearth.nasa.gov/view_rec.php?id=8391</A>
</BODY>
</HTML>