{"id":316,"date":"2017-05-27T09:17:23","date_gmt":"2017-05-27T09:17:23","guid":{"rendered":"https:\/\/vining.in\/blog\/?p=316"},"modified":"2017-05-27T10:58:54","modified_gmt":"2017-05-27T10:58:54","slug":"merge-text-image-save-media-library-visual-studio-2012-using-c","status":"publish","type":"post","link":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/","title":{"rendered":"merge text on image and save it into the media library \u2013 Visual Studio 2012 using C#"},"content":{"rendered":"<p>To merge text and image into a single image, we have to convert the image to a writable bitmap, render the text over the image and position it, and then save the image.<\/p>\n<pre class=\"lang:vbnet decode:true \">1) Create a textblock and name it \u201ctextblock1\u201d\r\n\r\n2) Assign some text to the textblock\r\n\r\n     textblock1.Text = \u201cGood morning\u201d;\r\n\r\n3) Convert the image to a writeable bitmap\r\n\r\n          WriteableBitmap wb = new WriteableBitmap((BitmapSource)myImage.Source);\r\n\r\n4) Position the textblock over the writeable bitmap\r\n\r\n          wb.Render(textblock1, new TranslateTransform() { X = 25, Y = 191 }); \r\n          wb.Invalidate();\r\n\r\n5) Save the image as jpeg to the media library\r\n\r\n          using (MemoryStream stream = new MemoryStream()) \r\n          { \r\n              wb.SaveJpeg(stream, wb.PixelWidth, wb.PixelHeight, 0, 100); \r\n              stream.Seek(0, SeekOrigin.Begin); \r\n              using (MediaLibrary mediaLibrary = new MediaLibrary()) \r\n                  mediaLibrary.SavePicture(\"Picture.jpg\", stream); \r\n          } \r\n          MessageBox.Show(\"Picture Saved\u2026\");<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To merge text and image into a single image, we have to convert the image to a writable bitmap, render the text over the image and position it, and then save the image. 1) Create a textblock and name it \u201ctextblock1\u201d 2) Assign some text to the textblock textblock1.Text = \u201cGood morning\u201d; 3) Convert the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-net-cvb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>merge text on image and save it into the media library-programmercode.in<\/title>\n<meta name=\"description\" content=\"Merge text on image and save it into the media library in visual studio12. If face any related this type of problem so you can use this code\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"merge text on image and save it into the media library-programmercode.in\" \/>\n<meta property=\"og:description\" content=\"Merge text on image and save it into the media library in visual studio12. If face any related this type of problem so you can use this code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Programmer Code\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vining.in\" \/>\n<meta property=\"article:published_time\" content=\"2017-05-27T09:17:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-05-27T10:58:54+00:00\" \/>\n<meta name=\"author\" content=\"codeadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"codeadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/\",\"url\":\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/\",\"name\":\"merge text on image and save it into the media library-programmercode.in\",\"isPartOf\":{\"@id\":\"https:\/\/vining.in\/blog\/#website\"},\"datePublished\":\"2017-05-27T09:17:23+00:00\",\"dateModified\":\"2017-05-27T10:58:54+00:00\",\"author\":{\"@id\":\"https:\/\/vining.in\/blog\/#\/schema\/person\/cda9f07adf3479ac270e2320a914552e\"},\"description\":\"Merge text on image and save it into the media library in visual studio12. If face any related this type of problem so you can use this code\",\"breadcrumb\":{\"@id\":\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vining.in\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"merge text on image and save it into the media library \u2013 Visual Studio 2012 using C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vining.in\/blog\/#website\",\"url\":\"https:\/\/vining.in\/blog\/\",\"name\":\"Programmer Code\",\"description\":\"- Where Developers Learn, Share, &amp; Build Careers\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vining.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/vining.in\/blog\/#\/schema\/person\/cda9f07adf3479ac270e2320a914552e\",\"name\":\"codeadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vining.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/770f5bb2b95d41f98f29e7251fb1873b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/770f5bb2b95d41f98f29e7251fb1873b?s=96&d=mm&r=g\",\"caption\":\"codeadmin\"},\"url\":\"https:\/\/vining.in\/blog\/author\/codeadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"merge text on image and save it into the media library-programmercode.in","description":"Merge text on image and save it into the media library in visual studio12. If face any related this type of problem so you can use this code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/","og_locale":"en_US","og_type":"article","og_title":"merge text on image and save it into the media library-programmercode.in","og_description":"Merge text on image and save it into the media library in visual studio12. If face any related this type of problem so you can use this code","og_url":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/","og_site_name":"Programmer Code","article_publisher":"https:\/\/www.facebook.com\/vining.in","article_published_time":"2017-05-27T09:17:23+00:00","article_modified_time":"2017-05-27T10:58:54+00:00","author":"codeadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"codeadmin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/","url":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/","name":"merge text on image and save it into the media library-programmercode.in","isPartOf":{"@id":"https:\/\/vining.in\/blog\/#website"},"datePublished":"2017-05-27T09:17:23+00:00","dateModified":"2017-05-27T10:58:54+00:00","author":{"@id":"https:\/\/vining.in\/blog\/#\/schema\/person\/cda9f07adf3479ac270e2320a914552e"},"description":"Merge text on image and save it into the media library in visual studio12. If face any related this type of problem so you can use this code","breadcrumb":{"@id":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vining.in\/blog\/merge-text-image-save-media-library-visual-studio-2012-using-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vining.in\/blog\/"},{"@type":"ListItem","position":2,"name":"merge text on image and save it into the media library \u2013 Visual Studio 2012 using C#"}]},{"@type":"WebSite","@id":"https:\/\/vining.in\/blog\/#website","url":"https:\/\/vining.in\/blog\/","name":"Programmer Code","description":"- Where Developers Learn, Share, &amp; Build Careers","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vining.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/vining.in\/blog\/#\/schema\/person\/cda9f07adf3479ac270e2320a914552e","name":"codeadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vining.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/770f5bb2b95d41f98f29e7251fb1873b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/770f5bb2b95d41f98f29e7251fb1873b?s=96&d=mm&r=g","caption":"codeadmin"},"url":"https:\/\/vining.in\/blog\/author\/codeadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":1,"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions\/317"}],"wp:attachment":[{"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vining.in\/blog\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}