Many thanks, <br><br>that seems to work beautifully. <br><br>So far I had been using tiff images as an intermediate container when creating files for which no Create() method is available, but the in memory MEM format&nbsp; of course is much superior, no fuss with temp files and no need to write to disk.
<br><br>Regards<br><br>Ludwig<br><br><br><div><span class="gmail_quote">On 28/05/07, <b class="gmail_sendername">Frank Warmerdam</b> &lt;<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ludwig M Brinckmann wrote:<br>&gt; I need to create paletted PNG files with transparency.<br>&gt;<br>&gt; I understand that I need to pass in a colour table with the alpha<br>&gt; channel set to 0.<br>&gt;<br>&gt; As I cannot create PNGs directly, I first create a Tiff with the
<br>&gt; colourtable and then do a CreateCopy.<br>&gt;<br>&gt; But when I then look at the PNG colour table, the transparency values<br>&gt; are gone (all set to 255). This is also true for the intermediate Tiff<br>&gt; file -- which is understandable as single band tiffs don&#39;t do
<br>&gt; transparency. I think when creating the tiff the colourtable is adjusted<br>&gt; so that it works for the Tiff, but then my transparencies are lost. (If<br>&gt; someone thinks this is a bug, I will turn my code into a short example).
<br>&gt;<br>&gt; I tried to alter the colour table after creating the tiff (or the<br>&gt; createCopy of the PNG), but this is not supported.<br>&gt;<br>&gt; What&#39;s the best way to do this -- maybe I just need a better
<br>&gt; intermediate format that does transparencies and can be created (which<br>&gt; one?)<br><br>Ludwig,<br><br>If you image isn&#39;t too large, and you are doing programatically (or<br>via scripts) you might want to use MEM format as your intermediate format.
<br>I believe it supports fully featured color tables, and no mess and fuss<br>with intermediate file cleanup.<br><br>&nbsp;&nbsp; <a href="http://www.gdal.org/frmt_mem.html">http://www.gdal.org/frmt_mem.html</a><br><br>Note, when creating MEM datasets and not needing to attach to an existing
<br>array in memory, just use any name for the dataset, such as &quot;tempimage&quot;.<br><br>Best regards,<br>--<br>---------------------------------------+--------------------------------------<br>I set the clouds in motion - turn up&nbsp;&nbsp; | Frank Warmerdam, 
<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a><br>light and sound - activate the windows | <a href="http://pobox.com/~warmerdam">http://pobox.com/~warmerdam</a><br>and watch the world go round - Rush&nbsp;&nbsp;&nbsp;&nbsp;| President OSGeo, 
<a href="http://osgeo.org">http://osgeo.org</a><br><br></blockquote></div><br>