# Create an image (png, jpg,...) from silverlight control

**URL:** <https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044>\
**Category:** Silverlight\
**Created:** [September 28, 2015, 10:25am UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044 "2015-09-28T10:25:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rustam](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/2bfe46/32.png) [@Rustam](https://community.thinkgeo.com/u/Rustam)\
**Post date:** [September 28, 2015, 10:25am UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044/1 "2015-09-28T10:25:38Z")

</div>

Hi,  
  
  
  
Is&nbsp;there&nbsp;a&nbsp;way&nbsp;to&nbsp;export&nbsp;Map&nbsp;content&nbsp;in&nbsp;Silverlight&nbsp;to&nbsp;any&nbsp;bitmap&nbsp;format&nbsp;(jpg,&nbsp;png,&nbsp;…)?  
  
I&nbsp;am&nbsp;using&nbsp;Map&nbsp;class&nbsp;from&nbsp;ThinkGeo.MapSuite.SilverlightEdition&nbsp;namespace.

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [September 29, 2015, 1:16am UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044/2 "2015-09-29T01:16:24Z")

</div>

Hi&nbsp;Rustam,&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;found&nbsp;somebody&nbsp;mentioned&nbsp;WriteableBitmap&nbsp;class&nbsp;maybe&nbsp;helpful&nbsp;for&nbsp;your&nbsp;requirement.&nbsp;  
&nbsp;&nbsp;  
&nbsp;[stackoverflow.com/questions/4499559/silverlight-draw-on-bitmap](http://stackoverflow.com/questions/4499559/silverlight-draw-on-bitmap)&nbsp;  
&nbsp;&nbsp;  
&nbsp;Or&nbsp;you&nbsp;should&nbsp;want&nbsp;to&nbsp;loop&nbsp;all&nbsp;overlay&nbsp;and&nbsp;layers,&nbsp;then&nbsp;create&nbsp;your&nbsp;graphic&nbsp;and&nbsp;draw&nbsp;on&nbsp;it&nbsp;one&nbsp;by&nbsp;one,&nbsp;but&nbsp;not&nbsp;all&nbsp;overlay&nbsp;can&nbsp;support&nbsp;draw&nbsp;by&nbsp;this&nbsp;way.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Rustam](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/2bfe46/32.png) [@Rustam](https://community.thinkgeo.com/u/Rustam)\
**Post date:** [September 29, 2015, 2:12am UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044/3 "2015-09-29T02:12:31Z")

</div>

Hi&nbsp;Don,  
  
  
  
Thanks&nbsp;for&nbsp;your&nbsp;answer!  
  
  
  
I&nbsp;tried&nbsp;with&nbsp;WriteableBitmap.&nbsp;It&nbsp;draws&nbsp;on&nbsp;it&nbsp;correctly,&nbsp;but&nbsp;when&nbsp;I’m&nbsp;trying&nbsp;to&nbsp;access&nbsp;Pixels&nbsp;property&nbsp;of&nbsp;the&nbsp;bitmap,&nbsp;it&nbsp;throws&nbsp;an&nbsp;exception:  
  
  
  
System.Security.SecurityException  
  
"WriteableBitmap&nbsp;has&nbsp;protected&nbsp;content.&nbsp;Pixel&nbsp;access&nbsp;is&nbsp;not&nbsp;allowed."  
  
&nbsp;&nbsp;&nbsp;at&nbsp;System.Windows.Media.Imaging.WriteableBitmap.get\_Pixels()  
  
  
  
I&nbsp;need&nbsp;to&nbsp;get&nbsp;pixels&nbsp;and&nbsp;send&nbsp;it&nbsp;to&nbsp;a&nbsp;web&nbsp;service.  
  
  
  
Also&nbsp;I&nbsp;tried&nbsp;to&nbsp;draw&nbsp;layers,&nbsp;it’s&nbsp;OK&nbsp;with&nbsp;all&nbsp;my&nbsp;features&nbsp;layers,&nbsp;but&nbsp;found&nbsp;no&nbsp;way&nbsp;to&nbsp;draw&nbsp;World&nbsp;Image.  
  
I&nbsp;am&nbsp;using&nbsp;&nbsp;WriteableBitmapGeoCanvas&nbsp;from&nbsp;ThinkGeo.MapSuite.SilverlightCore.  
  
Do&nbsp;you&nbsp;know&nbsp;how&nbsp;can&nbsp;I&nbsp;draw&nbsp;a&nbsp;world&nbsp;image&nbsp;on&nbsp;it?  
  
  
  
Thanks,  
  
Rustam

---

<div class="post-metadata">

**Author:** ![Ethan](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ethan/32/19964_2.png) [@Ethan](https://community.thinkgeo.com/u/Ethan)\
**Post date:** [September 29, 2015, 10:22pm UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044/4 "2015-09-29T22:22:19Z")

</div>

Hi&nbsp;Rustam,&nbsp;  
&nbsp;&nbsp;  
&nbsp;About&nbsp;draw&nbsp;layers,&nbsp;what’s&nbsp;the&nbsp;world&nbsp;image?&nbsp;If&nbsp;you&nbsp;meant&nbsp;something&nbsp;like&nbsp;GoogleMaps&nbsp;or&nbsp;BingMaps,&nbsp;I&nbsp;think&nbsp;we&nbsp;cannot&nbsp;draw&nbsp;them&nbsp;follow&nbsp;this&nbsp;way.&nbsp;If&nbsp;your&nbsp;world&nbsp;image&nbsp;is&nbsp;rendered&nbsp;by&nbsp;local&nbsp;shape&nbsp;file,&nbsp;you&nbsp;can&nbsp;just&nbsp;handle&nbsp;it&nbsp;as&nbsp;a&nbsp;common&nbsp;layer.&nbsp;  
&nbsp;&nbsp;  
&nbsp;I&nbsp;am&nbsp;sorry&nbsp;for&nbsp;WriteableBitmap&nbsp;I&nbsp;don’t&nbsp;have&nbsp;further&nbsp;experience&nbsp;on&nbsp;it,&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;solve&nbsp;related&nbsp;issue&nbsp;I&nbsp;think&nbsp;maybe&nbsp;you&nbsp;want&nbsp;to&nbsp;search&nbsp;more&nbsp;related&nbsp;topic.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Regards,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Don

---

<div class="post-metadata">

**Author:** ![Rustam](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/2bfe46/32.png) [@Rustam](https://community.thinkgeo.com/u/Rustam)\
**Post date:** [October 5, 2015, 9:58am UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044/5 "2015-10-05T09:58:31Z")

</div>

Sorry&nbsp;for&nbsp;the&nbsp;delay.  
  
  
  
The&nbsp;world&nbsp;map&nbsp;is&nbsp;the&nbsp;picture,&nbsp;that&nbsp;I&nbsp;am&nbsp;drawing&nbsp;using&nbsp;BingMapsOverlay&nbsp;class.  
  
  
  
Thanks!

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [October 6, 2015, 10:25am UTC](https://community.thinkgeo.com/t/create-an-image-png-jpg-from-silverlight-control/7044/6 "2015-10-06T10:25:37Z")

</div>

Hi&nbsp;Rustam,  
  
  
  
I&nbsp;guess&nbsp;there&nbsp;are&nbsp;2&nbsp;options,&nbsp;just&nbsp;outline&nbsp;them&nbsp;as&nbsp;following:  
  
  
  
1.&nbsp;&nbsp;Use&nbsp;BingMapsLayer&nbsp;from&nbsp;MapSuiteCore&nbsp;instead,&nbsp;thus&nbsp;we&nbsp;can&nbsp;export&nbsp;it&nbsp;image(png,&nbsp;Jpg&nbsp;etc.).  
  
2.&nbsp;Please&nbsp;try&nbsp;the&nbsp;solution&nbsp;mentioned&nbsp;at&nbsp;

[stackoverflow.com/questions/1139200/using-fjcore-to-encode-silverlight-writeablebitmap](http://stackoverflow.com/questions/1139200/using-fjcore-to-encode-silverlight-writeablebitmap),&nbsp;where&nbsp;shows&nbsp;how&nbsp;to&nbsp;export&nbsp;a&nbsp;WritableBitmap&nbsp;into&nbsp;a&nbsp;Base64String.  
  
  
  
Thanks,  
  
Johnny
