<div dir="ltr"><div><div><div>THanks Mateusz,<br><br></div>You're right. I'm trying it as we speak.<br><br></div>In my case I have a <span style="font-family:monospace,monospace">std::vector<GByte*></span> of the 3 bands, where the <span style="font-family:monospace,monospace">GByte*</span> are allocated in the heap with <span style="font-family:monospace,monospace">new GByte[width*height]</span>. I guess that won't work because the three bands have to be one single memory chunk, am I right? I guess the only solution is to switch to single band float and merge rgb to float. I'd prefer not having to refactor the rest of the code. Is it possible to have a different address for each band?<br><br></div>All this is to support jpg as output. All the operations are done in my GByte array and it's only at the end that I create the dataset and image. At the moment I create a Tiff and finally createcopy to jpg.<br><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 3, 2016 at 9:10 PM, Mateusz Loskot <span dir="ltr"><<a href="mailto:mateusz@loskot.net" target="_blank">mateusz@loskot.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 3 June 2016 at 20:45, Pol Monsó Purtí <<a href="mailto:lluna.nova@gmail.com">lluna.nova@gmail.com</a>> wrote:<br>
> I've seen this mysterious article <a href="http://www.gdal.org/frmt_mem.html" rel="noreferrer" target="_blank">http://www.gdal.org/frmt_mem.html</a> which<br>
> references the `DATAPOINTER` option. I've seen another reference<br>
> [here](<a href="https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010583.html" rel="noreferrer" target="_blank">https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010583.html</a>)<br>
> which does<br>
><br>
><br>
> sprintf(filename,"MEM:::DATAPOINTER=%d,PIXELS=%d,LINES=%d,BANDS=1,DATATYPE=%d,PIXELOFFSET=0,LINEOFFSET=0,BANDOFFSET=0",datpt,pixels,lines,datatype);<br>
>     dataset = GDALOpen(filename,GA_Update);<br>
><br>
> How would this translate to c++?<br>
<br>
</span>The line above is valid C++, isn't it.<br>
If you followed to Frank's answer [1], you'd see it slightly corrected<br>
but the technique remains the same.<br>
<br>
[1] <a href="https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010603.html" rel="noreferrer" target="_blank">https://lists.osgeo.org/pipermail/gdal-dev/2006-November/010603.html</a><br>
<br>
Best regards,<br>
<span class="HOEnZb"><font color="#888888">--<br>
Mateusz Loskot, <a href="http://mateusz.loskot.net" rel="noreferrer" target="_blank">http://mateusz.loskot.net</a><br>
</font></span></blockquote></div><br></div>