# Convert WKB to Bitmap

**URL:** <https://community.thinkgeo.com/t/convert-wkb-to-bitmap/1668>\
**Category:** WinForms\
**Created:** [April 13, 2011, 11:34am UTC](https://community.thinkgeo.com/t/convert-wkb-to-bitmap/1668 "2011-04-13T11:34:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/47e85d/32.png) [@Nick1](https://community.thinkgeo.com/u/Nick1)\
**Post date:** [April 13, 2011, 11:34am UTC](https://community.thinkgeo.com/t/convert-wkb-to-bitmap/1668/1 "2011-04-13T11:34:21Z")

</div>

Hi,

don't&nbsp;you&nbsp;know,&nbsp;if&nbsp;there&nbsp;is&nbsp;any&nbsp;oppotunity&nbsp;to&nbsp;make&nbsp;this&nbsp;task&nbsp;true?&nbsp;I'd&nbsp;like&nbsp;to&nbsp;draw&nbsp;the&nbsp;feature&nbsp;from&nbsp;the&nbsp;map&nbsp;in&nbsp;the&nbsp;pictureBox&nbsp;control.&nbsp;I&nbsp;try:

byte[]&nbsp;wellKnownBinary&nbsp;=&nbsp;feature.GetWellKnownBinary();

MemoryStream&nbsp;ms&nbsp;=&nbsp;new&nbsp;MemoryStream(wellKnownBinary);

Bitmap&nbsp;bitmap&nbsp;=&nbsp;new&nbsp;Bitmap(ms);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;&nbsp;&nbsp;argument&nbsp;not&nbsp;valid

pictureBox1.Image&nbsp;=&nbsp;bitmap;

Thank&nbsp;you.

---

<div class="post-metadata">

**Author:** ![Nick1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/n/47e85d/32.png) [@Nick1](https://community.thinkgeo.com/u/Nick1)\
**Post date:** [April 14, 2011, 1:16am UTC](https://community.thinkgeo.com/t/convert-wkb-to-bitmap/1668/2 "2011-04-14T01:16:21Z")

</div>

Hi,

if&nbsp;there&nbsp;are&nbsp;any&nbsp;ideas,&nbsp;please,&nbsp;help&nbsp;:)

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 14, 2011, 2:50am UTC](https://community.thinkgeo.com/t/convert-wkb-to-bitmap/1668/3 "2011-04-14T02:50:28Z")

</div>

Nick,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;reproduced&nbsp;your&nbsp;problem&nbsp;properly,&nbsp;the&nbsp;reason&nbsp;is&nbsp;that&nbsp;you&nbsp;cannot&nbsp;construct&nbsp;a&nbsp;bitmap&nbsp;from&nbsp;a&nbsp;shape&nbsp;feature&nbsp;stream,&nbsp;maybe&nbsp;you&nbsp;have&nbsp;any&nbsp;misunderstandings&nbsp;on&nbsp;the&nbsp;conversion,&nbsp;the&nbsp;bitmap&nbsp;must&nbsp;to&nbsp;be&nbsp;construct&nbsp;from&nbsp;a&nbsp;image&nbsp;stream,&nbsp;if&nbsp;you&nbsp;forced&nbsp;to&nbsp;construct&nbsp;a&nbsp;bitmap&nbsp;from&nbsp;any&nbsp;other&nbsp;streams&nbsp;such&nbsp;as&nbsp;shape&nbsp;feature&nbsp;stream,&nbsp;obviously,&nbsp;it&nbsp;would&nbsp;threw&nbsp;the&nbsp;exceptions.&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;Please&nbsp;make&nbsp;sure&nbsp;it&nbsp;first&nbsp;and&nbsp;get&nbsp;the&nbsp;stream&nbsp;from&nbsp;a&nbsp;image&nbsp;then&nbsp;construct&nbsp;the&nbsp;bitmap&nbsp;object,&nbsp;also&nbsp;you&nbsp;can&nbsp;reference&nbsp;the&nbsp;documentation&nbsp;on&nbsp;the&nbsp;MSDN&nbsp;about&nbsp;Bitmap,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Any&nbsp;more&nbsp;questions&nbsp;please&nbsp;let&nbsp;us&nbsp;know&nbsp;again,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Scott,
