Add text to Image in ASP.NET

Sometimes, it is nice to have a text caption embedded into an image, rather than
display the caption in HTML. Fortunately, this is fairly straightforward in ASP.NET.

You can embed some text into the photo:

/image_text.aspx?i=/photo.jpg&t=Photo+of+You

Play around with the querystring. See how the caption changes when you
change the text in the querystring.

Here is the code for image_text.aspx

<%@ Page Language="c#"%>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %> 
<script runat="server">
	private void Page_Load(object sender, System.EventArgs e)
	{
		Bitmap bmp= new Bitmap(Server.MapPath(Request.QueryString["i"]));
		Graphics g=Graphics.FromImage(bmp);
		g.SmoothingMode = SmoothingMode.AntiAlias ;
		g.DrawString(Request.QueryString["t"], 
			new Font("verdana",12),SystemBrushes.WindowText, 1, 1);
		Response.ContentType="image/jpeg";
		bmp.Save(Response.OutputStream, bmp.RawFormat) ;
	}
</script>
Updated: March 6, 2015 — 5:26 pm

Comments

Add a Comment
  1. Your comment is awaiting moderation.

    Amazing many of awesome facts!
    https://www.lunarciel.com/
    pharmacy cost comparison
    canada pharmaceutical online ordering
    discount pharmacy online
    canadian pharmacy

  2. Your comment is awaiting moderation.

    Reliable data. Cheers!
    https://www.lunarciel.com/
    pharmacies in canada
    canadian cialis
    canadian cialis
    canadian online pharmacy

  3. Your comment is awaiting moderation.

    Helpful info. Appreciate it!
    https://www.dunamisproductions.com/
    online canadian pharmacy
    canadian viagra
    visit poster’s website
    canada pharmacy online

  4. Your comment is awaiting moderation.

    You actually revealed it well.
    https://www.dunamisproductions.com/
    canadian rx pharmacy online
    top rated canadian pharmacies online
    canadian drug
    canadian pharmacies without an rx

  5. Your comment is awaiting moderation.

    Beneficial info. Cheers.
    https://www.interlandchemie.com/
    best canadian pharmacies
    canada pharmacy online
    canada pharmacies without script
    online pharmacies canada

  6. Your comment is awaiting moderation.

    You actually reported this perfectly.
    https://www.lunarciel.com/
    online pharmacy no prescription
    canadian pharmacy online
    canadian drugstore online
    canada online pharmacies

  7. Your comment is awaiting moderation.

    Wonderful data. Cheers.
    https://www.lunarciel.com/
    prescription cost comparison
    aarp approved canadian online pharmacies
    prescription cost comparison
    canadian pharmacies that ship to us

  8. Your comment is awaiting moderation.

    Reliable data. Thanks a lot.
    https://www.visitwaushara.com/
    canadian family pharmacy
    trust pharmacy canada
    international pharmacies that ship to the usa
    canada pharmacy

  9. Your comment is awaiting moderation.

    Superb stuff. Kudos.
    https://www.dunamisproductions.com/
    online canadian pharcharmy
    canadian viagra
    online canadian pharmacy
    mexican pharmacies shipping to usa

  10. Your comment is awaiting moderation.

    You actually revealed it effectively!
    https://www.waltcoexpress.com/
    best canadian mail order pharmacies
    online pharmacies canada
    international pharmacies that ship to the usa
    canada drug

  11. Your comment is awaiting moderation.

    You mentioned that perfectly.
    https://www.lunarciel.com/
    canadian pharmacy uk delivery
    northwest pharmacy
    drug price
    online pharmacies of canada

  12. Your comment is awaiting moderation.

    Amazing postings, Thanks!
    https://www.interlandchemie.com/
    online pharmacy
    canada pharmaceuticals online
    online pharmacy no prescription needed
    northwestpharmacy

  13. Your comment is awaiting moderation.

    Terrific posts, Regards!
    https://www.dunamisproductions.com/
    canada drugs online
    canada online pharmacies
    canadian cialis
    canadian viagra

  14. Your comment is awaiting moderation.

    Wow loads of amazing information.
    https://www.interlandchemie.com/
    canadian pharmacies online
    mexican pharmacies shipping to usa
    canadian pharmacy online
    aarp approved canadian online pharmacies

  15. Your comment is awaiting moderation.

    Great forum posts. Cheers.
    https://www.dunamisproductions.com/
    prescription pricing
    mexican pharmacies shipping to usa
    pharmacy canada
    online pharmacies of canada

  16. Your comment is awaiting moderation.

    With thanks, Lots of postings!

    https://www.waltcoexpress.com/
    prescription pricing
    canadian pharmacy
    top rated canadian pharmacies online
    northwest pharmacy

  17. Your comment is awaiting moderation.

    Appreciate it, Plenty of knowledge.

    https://www.visitwaushara.com/
    canadian discount pharmacy
    canada pharmacy online
    canada pharmacies prescription drugs
    mexican pharmacies shipping to usa

  18. Your comment is awaiting moderation.

    Regards! A good amount of advice!

    https://www.waltcoexpress.com/
    buy online prescription drugs
    canadian viagra
    canadian family pharmacy
    canadian pharmacies without an rx

  19. Your comment is awaiting moderation.

    Superb tips. Thank you.
    https://www.waltcoexpress.com/
    canadian pharmacies that are legit
    trust pharmacy canada
    canada pharmacy online orders
    canadian pharmaceuticals online

  20. Your comment is awaiting moderation.

    Kudos. Ample knowledge.

    https://www.dunamisproductions.com/
    top rated canadian pharmacies online
    canada pharmaceutical online ordering
    most reliable canadian pharmacies
    canadian cialis

  21. Your comment is awaiting moderation.

    Wonderful write ups. Cheers.
    https://www.visitwaushara.com/
    online pharmacy without a prescription
    canadian pharmacies-24h
    canadian rx
    northwest pharmacy

  22. Your comment is awaiting moderation.

    Lovely content. Thank you!
    https://www.interlandchemie.com/
    drugs online
    canadian cialis
    internet pharmacy
    northwest pharmacy

  23. Your comment is awaiting moderation.

    You actually said it fantastically!
    https://www.waltcoexpress.com/
    meds online
    northwestpharmacy
    candrugstore com
    canada pharmacy online

  24. Your comment is awaiting moderation.

    This is nicely expressed! .
    https://www.waltcoexpress.com/
    discount drugs online pharmacy
    north west pharmacy canada
    canada pharmacy no prescription
    canadian online pharmacy

  25. Your comment is awaiting moderation.

    Really tons of amazing knowledge!
    https://www.waltcoexpress.com/
    canadian drug
    canada online pharmacies
    canadian online pharmacy reviews
    canadian pharmacies-24h

  26. Your comment is awaiting moderation.

    You actually stated that perfectly.
    https://www.waltcoexpress.com/
    top rated canadian pharmacies online
    canadian pharmacies that ship to us
    prescription drugs without doctor approval
    canada pharmaceutical online ordering

  27. Your comment is awaiting moderation.

    Wonderful information. Thank you!
    https://www.lunarciel.com/
    pharmacy drug store
    canadian cialis
    canada pharmacies online prescriptions
    trust pharmacy canada

  28. Your comment is awaiting moderation.

    Well spoken without a doubt! !
    https://www.dunamisproductions.com/
    buy prescription drugs online
    mexican pharmacies shipping to usa
    prescription drugs without prior prescription
    canada pharmaceuticals online

  29. Your comment is awaiting moderation.

    Whoa plenty of useful material!
    https://www.waltcoexpress.com/
    canadian pharmacy viagra brand
    canada drug
    canadapharmacyonline com
    canadian pharmacy online

  30. Your comment is awaiting moderation.

    You said it perfectly..
    https://www.waltcoexpress.com/
    online drugs
    trust pharmacy canada
    canadian pharmacy no prescription needed
    canadian viagra

  31. Your comment is awaiting moderation.

    Seriously lots of very good tips!
    https://www.interlandchemie.com/
    prescription drug assistance
    global pharmacy canada
    canada pharmacies online prescriptions
    canadian pharmacies online

  32. Your comment is awaiting moderation.

    You actually explained it really well.
    https://www.lunarciel.com/
    highest rated canadian pharmacies
    aarp approved canadian online pharmacies
    mexican pharmacies
    canadian pharmacies

  33. Your comment is awaiting moderation.

    Truly quite a lot of beneficial data.
    https://www.waltcoexpress.com/
    rx pharmacy
    canada drugs
    canada pharmacies online
    canadian pharmacies without an rx

  34. Your comment is awaiting moderation.

    Effectively spoken indeed! !
    https://www.visitwaushara.com/
    no prescription pharmacies
    canadian online pharmacy
    canadian drug
    canadian pharmacies that ship to us

  35. Your comment is awaiting moderation.

    Regards, Plenty of data!

    https://www.lunarciel.com/
    online pharmacy usa
    canada online pharmacies
    pharmacy online
    canadian pharmaceuticals online

  36. Your comment is awaiting moderation.

    With thanks, An abundance of posts.

    https://www.visitwaushara.com/
    online canadian pharcharmy
    canada pharmaceutical online ordering
    my canadian pharmacy
    canada drugs

  37. Your comment is awaiting moderation.

    Cheers! Numerous postings!

    https://www.waltcoexpress.com/
    discount drugs online pharmacy
    northwestpharmacy
    canadadrugs.com pharmacy
    mexican pharmacies shipping to usa

  38. Your comment is awaiting moderation.

    Seriously many of superb tips.
    https://www.dunamisproductions.com/
    canadian pharmacies that are legit
    canadian drugs
    prescription drugs canada
    canadian pharmacies online

  39. Your comment is awaiting moderation.

    You stated it superbly!
    https://www.visitwaushara.com/
    drug prices comparison
    canadian pharmacy online
    costco pharmacy pricing
    canada drug

  40. Your comment is awaiting moderation.

    Thanks a lot! Ample write ups.

    https://www.visitwaushara.com/
    canadian rx
    aarp approved canadian online pharmacies
    best online canadian pharcharmy
    canadian online pharmacies

  41. Your comment is awaiting moderation.

    Cheers. Useful stuff!
    https://www.interlandchemie.com/
    canadian drugstore
    canadian drugs
    canadian pharmacy without prescription
    canadian pharmacy online

  42. Your comment is awaiting moderation.

    You’ve made the point.
    https://www.interlandchemie.com/
    mexican pharmacy online medications
    canadianpharmacy
    onlinecanadianpharmacy.com
    top rated canadian pharmacies online

  43. Your comment is awaiting moderation.

    You reported this perfectly!
    https://www.waltcoexpress.com/
    onlinecanadianpharmacy.com
    canada drugs
    canadian pharmacy online canada
    canadian pharmacies online

  44. Your comment is awaiting moderation.

    You mentioned that terrifically.
    https://www.dunamisproductions.com/
    prescription prices comparison
    canadian pharmacy online
    prescription drugs online without
    online pharmacies canada

  45. Your comment is awaiting moderation.

    Amazing tons of great material!
    https://www.lunarciel.com/
    cheap prescription drugs online
    aarp approved canadian online pharmacies
    rx price comparison
    canadian viagra

  46. Your comment is awaiting moderation.

    You actually reported this effectively.
    https://www.lunarciel.com/
    canadian online pharmacy reviews
    canadian cialis
    pharmacies in canada
    canadian pharcharmy

  47. Your comment is awaiting moderation.

    Thanks a lot, A good amount of info.

    https://www.dunamisproductions.com/
    prescription online
    canadian online pharmacy
    no prescription pharmacies
    canadian pharmacies without an rx

  48. Your comment is awaiting moderation.

    You’ve made your position extremely well.!
    https://www.visitwaushara.com/
    pharmacy online mexico
    canadian pharmacies
    most reliable canadian pharmacies
    northwestpharmacy

  49. Your comment is awaiting moderation.

    Many thanks! I appreciate it!
    https://www.dunamisproductions.com/
    canada drugs online
    canadian pharmacies that ship to us
    canada pharmacy online orders
    mexican pharmacies shipping to usa

  50. Your comment is awaiting moderation.

    You actually said that perfectly!
    https://www.dunamisproductions.com/
    buy online prescription drugs
    canadian pharmacy online
    canadian drugstore reviews
    canadian pharmacies-24h

  51. Your comment is awaiting moderation.

    Amazing posts. Thanks.
    https://www.interlandchemie.com/
    pharmacy cost comparison
    canada drugs online
    discount prescription drug
    canada drug

  52. Your comment is awaiting moderation.

    Thank you. I like it!
    https://www.visitwaushara.com/
    overseas pharmacies
    north west pharmacy canada
    online pharmacy no prescription
    canadian pharmacies

  53. Your comment is awaiting moderation.

    You reported this terrifically.
    https://nicktambone.com/
    cialis online
    canada drug
    pharmacy online store
    london drugs canada

  54. Your comment is awaiting moderation.

    Wonderful advice. Regards.
    http://talahicc.com/
    canada meds
    canadian pharmacies that ship to us
    online rx pharmacy
    trust pharmacy canada

  55. Your comment is awaiting moderation.

    Wonderful posts. Appreciate it.
    http://www.canadianpharmacymsn.com/
    canadian drugstore reviews
    canadian pharmaceuticals online
    best online pharmacies canada
    canadian online pharmacy

  56. Your comment is awaiting moderation.

    Whoa all kinds of excellent knowledge!
    http://canadianpharmacymim.com/
    drugs without prescription
    aarp approved canadian online pharmacies
    prescription drug cost
    canada pharmacy online

  57. Your comment is awaiting moderation.

    Thank you, Plenty of data.

    http://canadianpharmacymim.com/
    no prescription pharmacies
    canadian online pharmacy
    canada drug
    online pharmacies canada

  58. Your comment is awaiting moderation.

    You expressed it effectively.
    http://talahicc.com/
    canada pharmacies prescription drugs
    canadian pharcharmy
    highest rated canadian pharmacies
    canadian pharmacies-24h

  59. Your comment is awaiting moderation.

    You explained that well!
    http://canadianpharmaciesnnm.com/
    canadian online pharmacy reviews
    canadian pharmacies-24h
    discount pharmacy
    online pharmacies canada

  60. Your comment is awaiting moderation.

    Terrific content. Thank you!
    http://canadianpharmacyntx.com/
    global pharmacy canada
    canadian pharmacies online
    canadian pharmacy online canada
    canadian pharmacy

  61. Your comment is awaiting moderation.

    Superb facts, Thanks!
    http://www.canadianpharmacymsn.com/
    best canadian mail order pharmacies
    canadian pharcharmy
    canadian prescription
    global pharmacy canada

  62. Your comment is awaiting moderation.

    You actually said that effectively!
    http://canadianpharmacyntx.com/
    canadian drugstore reviews
    canadian pharmaceuticals online
    prescription drugs without prior prescription
    canadianpharmacy

  63. Your comment is awaiting moderation.

    You actually said it terrifically.
    http://canadianpharmacyntx.com/
    canadian drugstore
    online pharmacies of canada
    canada drugs
    canadian pharmacies online

  64. Your comment is awaiting moderation.

    Lovely information. Kudos.
    http://canadianpharmacysilo.com/
    online rx pharmacy
    canadian viagra
    mexican pharmacy online
    canadian viagra

  65. Your comment is awaiting moderation.

    Fine write ups. Many thanks.
    https://nicktambone.com/
    canadian rx pharmacy online
    canadian viagra
    prescription drugs online without doctor
    online pharmacies of canada

  66. Your comment is awaiting moderation.

    You made your point.
    http://www.canadianpharmacymsn.com/
    prescription drugs online without doctor
    canadian pharmacy online
    international pharmacy
    trust pharmacy canada

  67. Your comment is awaiting moderation.

    Wonderful information, Cheers.
    http://talahicc.com/
    reputable canadian mail order pharmacies
    aarp approved canadian online pharmacies
    best online pharmacy
    online pharmacies canada

  68. Your comment is awaiting moderation.

    Nicely put. Many thanks.
    http://www.canadianpharmacymsn.com/
    online pharmacies
    northwest pharmacy
    canadian rx
    canadian drugs

  69. Your comment is awaiting moderation.

    Awesome forum posts. Thanks a lot.
    http://canadianpharmacymim.com/
    canadian pharmacies online
    canadian online pharmacies
    most reliable canadian pharmacies
    canada pharmaceuticals online

  70. Your comment is awaiting moderation.

    Cheers! Numerous postings!

    http://canadianonlinepharmacynnm.com/
    canadian rx pharmacy online
    canadianpharmacy
    canadian rx
    aarp approved canadian online pharmacies

  71. Your comment is awaiting moderation.

    You actually stated it exceptionally well.
    http://canadianpharmacymim.com/
    mail order pharmacy
    canadian pharmacies without an rx
    canadian cialis
    northwestpharmacy

  72. Your comment is awaiting moderation.

    Nicely put, Kudos.
    http://canadianpharmacymim.com/
    international pharmacies that ship to the usa
    canadian pharmacy online
    canada drugs
    canadian online pharmacy

  73. Your comment is awaiting moderation.

    You’ve made your point pretty clearly..
    http://canadianpharmacysilo.com/
    most reliable canadian pharmacies
    canadian pharmacies
    candrugstore com
    northwest pharmacy

  74. Your comment is awaiting moderation.

    You actually revealed that fantastically.
    http://canadianonlinepharmacynnm.com/
    buy cialis
    canadian pharmacies online
    canadadrugs.com pharmacy
    london drugs canada

  75. Your comment is awaiting moderation.

    Valuable material. Thank you.
    http://www.canadianpharmacymsn.com/
    canadian drugstore reviews
    canadian pharmacies
    no prescription pharmacies
    london drugs canada

  76. Your comment is awaiting moderation.

    Truly loads of fantastic material!
    http://canadianpharmaciesnnm.com/
    online drugstore
    canada drugs online
    best canadian mail order pharmacies
    canada drug

  77. Your comment is awaiting moderation.

    Good forum posts. Thanks a lot!
    http://canadianonlinepharmacynnm.com/
    get prescription online
    canadian pharmacies without an rx
    prescription drugs prices
    canadian pharmacies that ship to us

  78. Your comment is awaiting moderation.

    Thank you, Great stuff.
    http://canadianpharmaciescubarx.com/
    discount prescription drug
    canadian pharmacies
    canadian drugs without prescription
    canada drugs

  79. Your comment is awaiting moderation.

    You said it adequately..
    http://canadianpharmacymim.com/
    prescription drug assistance
    trust pharmacy canada
    online pharmacy without prescription
    canadian viagra

  80. Your comment is awaiting moderation.

    Cheers. Valuable stuff.
    http://canadianpharmacyntx.com/
    canadian mail order pharmacies
    london drugs canada
    discount prescription drug
    canada pharmacy

  81. Your comment is awaiting moderation.

    Regards! Lots of stuff.

    http://canadianpharmaciesnnm.com/
    online pharmacy without a prescription
    trust pharmacy canada
    canadian pharmacy viagra
    aarp approved canadian online pharmacies

  82. Your comment is awaiting moderation.

    You’ve made your stand extremely clearly..
    http://talahicc.com/
    web medical information
    trust pharmacy canada
    best online canadian pharcharmy
    canada pharmacy

  83. Your comment is awaiting moderation.

    Nicely put. Kudos!
    http://www.canadianpharmacymsn.com/
    pharmacy tech
    northwest pharmacy
    buy prescription drugs from canada
    northwestpharmacy

  84. Your comment is awaiting moderation.

    You said it nicely..
    http://canadianpharmacymim.com/
    drug prices comparison
    canadian online pharmacies
    canada pharmacies online
    canadian pharmaceuticals online

  85. Your comment is awaiting moderation.

    Nicely put, Many thanks.
    http://www.canadianpharmacymsn.com/
    canadapharmacyonline.com
    london drugs canada
    drug price
    canadian drugs

  86. Your comment is awaiting moderation.

    Cheers, I enjoy it!
    http://talahicc.com/
    canadian drug
    northwestpharmacy
    no prescription pharmacies
    canadian pharmacies-24h

  87. Your comment is awaiting moderation.

    Excellent posts. Thanks a lot!
    http://canadianpharmacysilo.com/
    pharmacies in canada
    online pharmacies canada
    visit poster’s website
    aarp approved canadian online pharmacies

  88. Your comment is awaiting moderation.

    Superb tips. Thank you!
    http://talahicc.com/
    buy cialis
    canadian cialis
    mexican pharmacies online
    online pharmacies of canada

  89. Your comment is awaiting moderation.

    Amazing plenty of superb knowledge!
    http://canadianpharmaciescubarx.com/
    canadian drugstore
    london drugs canada
    price prescription drugs
    canadian pharmaceuticals online

  90. Your comment is awaiting moderation.

    Helpful facts. Cheers!
    http://canadianonlinepharmacynnm.com
    buy prescription drugs canada
    canada pharmaceutical online ordering
    canadianpharmacy
    northwest pharmacy

Leave a Reply

Your email address will not be published. Required fields are marked *