Answered by:
How to add text or draw text on image using silverlight programatically?

Question
-
Actually i am using silverlight object model , i want to add text on image .So how can i do it.
This is What I wanted to do :
Using Graphics object and Bitmap
1) Get a photo from the Picture Library or Folder
2) Draw text or i want to write text on multiple position in the image .
3) Save it back to the Picture Library
ally- Edited by marut.mahajan Friday, February 17, 2012 7:49 AM
Friday, February 17, 2012 7:27 AM
Answers
-
Hi ally,
1)Get a photo from the Picture Library or Folder
You can refer the below code to get the picture url in picture library:
using (SPSite site = new SPSite("http://spsv")) { SPWeb web = site.RootWeb; SPList list = web.Lists["MyPicture"]; SPListItem item = list.GetItemById(1); Console.WriteLine(item.Url); Console.ReadKey(); }
2) Draw text or i want to write text on multiple position in the image .
Please go to Silverlight forum for more help:
http://forums.silverlight.net/
3) Save it back to the Picture Library
Below is code sample to upload a picture to picture library:
using (var site = new SPSite("http://localhost")) { using (SPWeb web = site.OpenWeb()) { SPPictureLibrary pics = (SPPictureLibrary)web.Lists["MyPictureLibrary"]; foreach (UploadedFile file in RadUpload1.UploadedFiles) { using (Stream fs = file.InputStream) { pics.RootFolder.Files.Add(file.GetName(), fs); } } } }
Thanks,
SimonSimon Huang
TechNet Community Support
- Marked as answer by Shimin Huang Friday, February 24, 2012 5:26 AM
Wednesday, February 22, 2012 7:29 AM
All replies
-
This blog post contains code for down- and uploading list items. The rest of your question is really not SharePoint related at all, try that at a Silverlight forum.
Kind regards,
Margriet BruggemanLois & Clark IT Services
web site: http://www.loisandclark.eu
blog: http://www.sharepointdragons.com
Friday, February 17, 2012 7:57 AM -
Hi ally,
1)Get a photo from the Picture Library or Folder
You can refer the below code to get the picture url in picture library:
using (SPSite site = new SPSite("http://spsv")) { SPWeb web = site.RootWeb; SPList list = web.Lists["MyPicture"]; SPListItem item = list.GetItemById(1); Console.WriteLine(item.Url); Console.ReadKey(); }
2) Draw text or i want to write text on multiple position in the image .
Please go to Silverlight forum for more help:
http://forums.silverlight.net/
3) Save it back to the Picture Library
Below is code sample to upload a picture to picture library:
using (var site = new SPSite("http://localhost")) { using (SPWeb web = site.OpenWeb()) { SPPictureLibrary pics = (SPPictureLibrary)web.Lists["MyPictureLibrary"]; foreach (UploadedFile file in RadUpload1.UploadedFiles) { using (Stream fs = file.InputStream) { pics.RootFolder.Files.Add(file.GetName(), fs); } } } }
Thanks,
SimonSimon Huang
TechNet Community Support
- Marked as answer by Shimin Huang Friday, February 24, 2012 5:26 AM
Wednesday, February 22, 2012 7:29 AM