This is because there's no driver to recognise the image data directly. You should provide the image file in a GDAL supported binary format (like jpg or png or tif) or use the MEM driver to represent the dataset. I've created a new sample for this approach at:<div>
<br></div><div><a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALMemDataset.cs">http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALMemDataset.cs</a></div><div><br></div><div>In this example I create the bands in a reverse order as it looks like the Windows bitmap format requires it.</div>
<div><br></div><div><br></div><div>Best regards,</div><div><br></div><div>Tamas</div><div> </div><div><br><br><div class="gmail_quote">2013/3/23 Maksim Sestic <span dir="ltr"><<a href="mailto:max@geoinova.com" target="_blank">max@geoinova.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="blue">
<div>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">It's a Bitmap instance created using:<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"> bmp <font color="blue"><span style="color:blue">As</span></font> <font color="#2b91af"><span style="color:#2b91af">Bitmap</span></font> = <font color="#2b91af"><span style="color:#2b91af">Bitmap</span></font>.FromFile(<font color="#a31515"><span style="color:#a31515">"C:\Input.png"</span></font>)<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">then converted to byte array (as per
MSDN article):<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="green" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:green">'
Lock the bitmap's bits.</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"> rect <font color="blue"><span style="color:blue">As</span></font> <font color="blue"><span style="color:blue">New</span></font> <font color="#2b91af"><span style="color:#2b91af">Rectangle</span></font>(0, 0, bmp.Width, bmp.Height)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">
bmpData <font color="blue"><span style="color:blue">As</span></font> <font color="#2b91af"><span style="color:#2b91af">BitmapData</span></font> =
bmp.LockBits(rect, <font color="#2b91af"><span style="color:#2b91af">ImageLockMode</span></font>.ReadOnly,
bmp.PixelFormat)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="green" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:green">'
Get the address of the first line.</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"> ptr <font color="blue"><span style="color:blue">As</span></font> <font color="#2b91af"><span style="color:#2b91af">IntPtr</span></font> = bmpData.Scan0<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="green" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:green">'
Declare an array to hold the bytes of the bitmap.</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">
bitmapData <font color="blue"><span style="color:blue">As</span></font> <font color="blue"><span style="color:blue">Byte</span></font>()<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">ReDim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">
bitmapData(<font color="#2b91af"><span style="color:#2b91af">Math</span></font>.Abs(bmpData.Stride)
* bmp.Height)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="green" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:green">'
Copy the RGB values into the array.</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="#2b91af" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Marshal</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">.Copy(ptr,
bitmapData, 0, bitmapData.Length)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="green" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:green">'
Unlock the bits.</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">bmp.UnlockBits(bmpData)<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">The rest is your code (abbreviated
version):<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="green" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:green">'Code
provided by Tamas Szekeres<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="#2b91af" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Gdal</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">.AllRegister()<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"> handle
<font color="blue"><span style="color:blue">As </span></font><font color="#2b91af"><span style="color:#2b91af">GCHandle</span></font> = <font color="#2b91af"><span style="color:#2b91af">GCHandle</span></font>.Alloc(bitmapData, <font color="#2b91af"><span style="color:#2b91af">GCHandleType</span></font>.Pinned)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">
memFilename <font color="blue"><span style="color:blue">As</span></font> <font color="blue"><span style="color:blue">String</span></font> = <font color="#a31515"><span style="color:#a31515">"/vsimem/inmemfile"</span></font><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="#2b91af" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Gdal</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">.FileFromMemBuffer(memFilename,
bitmapData.Length, handle.AddrOfPinnedObject())<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"> ds <font color="blue"><span style="color:blue">As</span></font> <font color="#2b91af"><span style="color:#2b91af">Dataset</span></font> = <font color="#2b91af"><span style="color:#2b91af">Gdal</span></font>.Open(memFilename, <font color="#2b91af"><span style="color:#2b91af">Access</span></font>.GA_ReadOnly) <font color="green"><span style="color:green">'<<< Exception gets thrown at this line</span></font><u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="blue" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:blue">Dim</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas"> drv <font color="blue"><span style="color:blue">As</span></font> <font color="#2b91af"><span style="color:#2b91af">Driver</span></font> = <font color="#2b91af"><span style="color:#2b91af">Gdal</span></font>.GetDriverByName(<font color="#a31515"><span style="color:#a31515">"GTiff"</span></font>)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">drv.CreateCopy(<font color="#a31515"><span style="color:#a31515">"C:\Output.tif"</span></font>,
ds, 0, <font color="blue"><span style="color:blue">Nothing</span></font>, <font color="blue"><span style="color:blue">Nothing</span></font>, <font color="blue"><span style="color:blue">Nothing</span></font>)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font color="#2b91af" face="Consolas"><span style="font-size:9.5pt;font-family:Consolas;color:#2b91af">Gdal</span></font><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">.Unlink(memFilename)<u></u><u></u></span></font></p>
<p class="MsoNormal" style="text-autospace:none"><font face="Consolas"><span style="font-size:9.5pt;font-family:Consolas">handle.Free()<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Sorry about my <a href="http://VB.NET" target="_blank">VB.NET</a> :-) <u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">I'm certain it's not about assembly referencing
issues and such, since it works correctly using "classic"
Gdal.Open(...) method.<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Regards,<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Maksim Sestic<u></u><u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"><u></u> <u></u></span></font></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">
Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>
<b><span style="font-weight:bold">Sent:</span></b> Saturday, March 23, 2013
23:46</span></font></p><div><div class="h5"><font face="Tahoma"><br>
<b><span style="font-weight:bold">To:</span></b> Maksim Sestic<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [gdal-dev] Converting
.NET Bitmap to GDAL Dataset</font></div></div><span lang="EN-US"><u></u><u></u></span><p></p>
</div><div><div class="h5">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">What is the input file you are using?<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Tamas<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">2013/3/23 Maksim Sestic <<a href="mailto:max@geoinova.com" target="_blank">max@geoinova.com</a>><u></u><u></u></span></font></p>
<div link="blue" vlink="blue">
<div>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Hi Tamas,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">It throws exception at line:</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font size="1" color="black" face="Courier New"><span style="font-size:8.5pt;font-family:"Courier New"">Dataset ds
= Gdal.Open(memFilename, Access.GA_ReadOnly);</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">...saying that </span></font><font size="1" color="#bb8844" face="Courier New"><span style="font-size:8.5pt;font-family:"Courier New";color:#bb8844">"/vsimem/inmemfile"</span></font><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> is not a recognized format.</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">I'm using GDAL 1.8.0, could it be version-related?</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Regards,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Maksim Sestic </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"> Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>
<b><span style="font-weight:bold">Sent:</span></b> Saturday, March 23, 2013
22:11</span></font><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Tahoma"><span style="font-size:12.0pt;font-family:Tahoma"><br>
<b><span style="font-weight:bold">To:</span></b> Maksim Sestic<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [gdal-dev] Converting
.NET Bitmap to GDAL Dataset</span></font><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Added a C# example
to demonstrate the usage of the /vsimem facilities.<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/VSIMem.cs" target="_blank">http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/VSIMem.cs</a><u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Best regards,<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Tamas<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">2013/3/23 Maksim
Sestic <<a href="mailto:max@geoinova.com" target="_blank">max@geoinova.com</a>><u></u><u></u></span></font></p>
<div link="blue" vlink="blue">
<div>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Hi Tamas,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Thanks for the help. I recall hitting this issue before as well: <a href="http://lists.osgeo.org/pipermail/gdal-dev/2012-May/032972.html" target="_blank">http://lists.osgeo.org/pipermail/gdal-dev/2012-May/032972.html</a></span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Regards,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Maksim Sestic</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">P.S.</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Sorry, just noticed that the conversation went to priv. only and
not to gdal-dev forum.</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"> Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>
<b><span style="font-weight:bold">Sent:</span></b> Saturday, March 23, 2013
10:56</span></font><u></u><u></u></p>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Tahoma"><span style="font-size:12.0pt;font-family:Tahoma"><br>
<b><span style="font-weight:bold">To:</span></b> Maksim Sestic<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [gdal-dev] Converting
.NET Bitmap to GDAL Dataset</span></font><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">You may probably
utilize the MEM driver (<a href="http://www.gdal.org/frmt_mem.html" target="_blank">http://www.gdal.org/frmt_mem.html</a>) or the vsimem virtual
file system <a href="http://gdal.org/cpl__vsi_8h.html#a66e2e6f093fd42f8a941b962d4c8a19e" target="_blank">http://gdal.org/cpl__vsi_8h.html#a66e2e6f093fd42f8a941b962d4c8a19e</a><u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Best regards,<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Tamas<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">2013/3/22 Maksim
Sestic <<a href="mailto:max@geoinova.com" target="_blank">max@geoinova.com</a>><u></u><u></u></span></font></p>
<div link="blue" vlink="blue">
<div>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Hi Tamas,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">You're right, thanks. </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">I was trying to create a pair of "roundtrip" classes
utilizing Gdal. First one would read e.g. a file into Bitmap instance, that's
what GDALRead.cs demonstrates perfectly. The other would write this Bitmap
instance using Gdal drivers back to e.g. another file. You might have guessed
that I was stuck at the second one. I neve actually coded against Gdal memory
driver, should give it a try I guess...</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Regards,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Maksim Sestic</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"> Tamas Szekeres [mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>
<b><span style="font-weight:bold">Sent:</span></b> Friday, March 22, 2013 22:58<br>
<b><span style="font-weight:bold">To:</span></b> Maksim Sestic<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [gdal-dev] Converting
.NET Bitmap to GDAL Dataset</span></font><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Dataset is
considered as an interface to the underlying driver. Aside from the 'in memory
driver' and some sort of internal caching facilities the dataset doesn't hold data
in memory. In this regard we cannot convert these 2 objects types to each
other. The most obvious action regarding to your requirement is to create and
in memory dataset and copy data from the bitmap to the dataset, as I've
mentioned before.<u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Best regards,<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Tamas<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">2013/3/22 Maksim
Sestic <<a href="mailto:max@geoinova.com" target="_blank">max@geoinova.com</a>><u></u><u></u></span></font></p>
<div link="blue" vlink="blue">
<div>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Hi Tamas,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">If I'm not mistaken, GDALWrite.cs and GDALDatasetWrite.cs examples
are about writing (using Create() method) a dataset to disk. What I'm trying to
do is to convert a System.Drawing.Bitmap instance to a GDAL.Dataset, in-memory
only. But I'm not sure about how to do it...</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Regards,</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue">Maksim Sestic</span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<p class="MsoNormal"><font color="blue" face="Verdana"><span style="font-size:10.0pt;font-family:Verdana;color:blue"> </span></font><u></u><u></u></p>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">
<hr size="2" width="100%" align="center">
</span></font></div>
<p class="MsoNormal"><b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma"> <a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>]
<b><span style="font-weight:bold">On Behalf Of </span></b>Tamas Szekeres<br>
<b><span style="font-weight:bold">Sent:</span></b> Friday, March 22, 2013 21:12<br>
<b><span style="font-weight:bold">To:</span></b> gdal-dev<br>
<b><span style="font-weight:bold">Subject:</span></b> [gdal-dev] Converting
.NET Bitmap to GDAL Dataset</span></font><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">For an example of
the reverse action see SaveBitMapDirect in <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALReadDirect.cs" target="_blank">GDALReadDirect.cs</a> <u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">To write data to
GDAL dataset see: <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALWrite.cs" target="_blank">GDALWrite.cs</a> or <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALDatasetWrite.cs" target="_blank">GDALDatasetWrite.cs</a><u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Best regards,<u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Tamas<u></u><u></u></span></font></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
<div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">2013/3/22 Maksim
Sestic <<a href="mailto:max@geoinova.com" target="_blank">max@geoinova.com</a>><u></u><u></u></span></font></p>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt">Hi all,<br>
<br>
Is there any example (or a hint) of converting a System.Drawing.Bitmap into<br>
GDAL Dataset?<br>
<br>
Regards,<br>
Maksim Sestic<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.n6.nabble.com/Converting-NET-Bitmap-to-GDAL-Dataset-tp5042430.html" target="_blank">http://osgeo-org.1560.n6.nabble.com/Converting-NET-Bitmap-to-GDAL-Dataset-tp5042430.html</a><br>
Sent from the GDAL - Dev mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><u></u><u></u></span></font></p>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> <u></u><u></u></span></font></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"><u></u> <u></u></span></font></p>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>