Hi Frank,<br><br>Ok, that makes sense.  So for this to work, I will have to know (somehow) what type of image mapserver is sending, and then instantiate a MEM dataset with the correct parameters.  Problem with that is that I can&#39;t think of a good way to read what those parameters are out of the binary string.  It&#39;s no problem when I know exactly what data is coming in, as is the case for my very specific need, but it means that swapping in GDAL for PIL as a general solution might not be possible.<br>
<br>I&#39;ll play around with the examples you&#39;ve sent, and will investigate whether there are ways to read the string and determine what data type it is.<br><br>One last question. How does a utility like gdal_translate figure out what the input data type is?<br>
<br>Thanks again,<br><br>Roger<br>--<br><br><br><div class="gmail_quote">On Sat, Jan 16, 2010 at 2:34 PM, Frank Warmerdam <span dir="ltr">&lt;<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Roger André wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Frank,<br>
<br>
Thanks for the example.  How can I specify alpha in that, for one of the quantized 8-bit PNG&#39;s (with alpha) that MapServer produces? <br>
</blockquote>
<br></div>
Roger,<br>
<br>
In a way this is simplier.  It is just a one band GDT_Byte file, so more<br>
like the first example I gave.  The palette can be handled separately,<br>
and assigned to the MEM dataset a bit like:<br>
<br>
    gdaltest.test_ct_data = [ (255,0,0), (0,255,0), (0,0,255), (255,255,255,0)]<br>
<br>
    gdaltest.test_ct = gdal.ColorTable()<br>
    for i in range(len(gdaltest.test_ct_data)):<br>
        gdaltest.test_ct.SetColorEntry( i, gdaltest.test_ct_data[i] )<br>
    mem_ds.GetRasterBand(1).SetColorTable( gdaltest.test_ct )<br>
<br>
Best regards,<div><div></div><div class="h5"><br>
-- <br>
---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up   | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
and watch the world go round - Rush    | Geospatial Programmer for Rent<br>
<br>
</div></div></blockquote></div><br>