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.

    You actually expressed this adequately!
    http://cialismsnrx.com/
    cialis cemu sluzi
    generic cialis
    cialis and niacin
    cialis online

  2. Your comment is awaiting moderation.

    Superb posts. Kudos!
    http://cialisttk.com/
    lloyds pharmacy cialis 20mg
    cialis 20 mg
    cialis price australia
    cialis online

  3. Your comment is awaiting moderation.

    Kudos. Lots of posts!

    http://cialismsnrx.com/
    o poder do cialis
    cialis without a doctor prescription
    cialis ontario drug plan
    cialis without a doctor prescription

  4. Your comment is awaiting moderation.

    Terrific material. Cheers!
    https://www.cialisfidel.com/
    cialis 28 years old
    generic cialis
    cialis generico en europa
    cialis 20mg

  5. Your comment is awaiting moderation.

    Wonderful data, Thank you!
    http://cialisttk.com/
    cialis hapД± yan etkileri
    cialis online
    cialis esophagus
    buy cialis online

  6. Your comment is awaiting moderation.

    You actually revealed it superbly.
    http://cialisttk.com/
    medicines not to take with cialis
    cheap cialis
    cialis prodaja apoteke
    cialis generic

  7. Your comment is awaiting moderation.

    Kudos. I enjoy this!
    http://cialismsnntx.com/
    deutsche cialis
    generic cialis
    canadian pharmacy viagra + cialis
    cialis generic

  8. Your comment is awaiting moderation.

    Thanks. A lot of advice!

    https://www.cialismim.com/
    prix du cialis 20 mg cpr4
    cialis 20mg
    duração cialis
    buy cialis online

  9. Your comment is awaiting moderation.

    Great material. Thanks a lot!
    https://www.cialismim.com/
    cialis 40 mg for sale
    cialis online
    how to buy cialis in philippines
    cialis online

  10. Your comment is awaiting moderation.

    Info nicely regarded!.
    http://cialispego.com/
    cialis dolor de piernas
    cialis 20mg
    cialis misljenje
    cialis generic

  11. Your comment is awaiting moderation.

    Regards, A lot of knowledge!

    http://cialismsnntx.com/
    can you take cialis after a heart attack
    cialis 20mg
    cuanto cuesta cialis en farmacia en mexico
    cialis without a doctor prescription

  12. Your comment is awaiting moderation.

    Reliable tips. Kudos.
    http://cialismsnrx.com/
    cialis left eye
    generic cialis
    cialis 5mg prix vidal
    buy cialis online

  13. Your comment is awaiting moderation.

    Nicely put. With thanks.
    https://www.cialisfidel.com/
    pro cialis 20 mg
    cialis without a doctor prescription
    cialis fГјr mann und frau
    cheap cialis

  14. Your comment is awaiting moderation.

    Good tips. Thank you.
    http://cialismsnntx.com/
    cialis vencido faz mal
    cialis 20mg
    cialis 5mg daily use review
    buy cialis online

  15. Your comment is awaiting moderation.

    Superb stuff. Kudos.
    http://cialisttk.com/
    cialis causes rashes
    cialis 20 mg
    how to get rid of a headache caused by cialis
    cialis online

  16. Your comment is awaiting moderation.

    Regards, I like this!
    https://www.cialismim.com/
    cialis sudden vision loss
    buy cialis online
    vasotec and cialis
    cheap cialis

  17. Your comment is awaiting moderation.

    Incredible a lot of wonderful information!
    http://cialismsnntx.com/
    est il possible d’acheter du cialis en pharmacie sans ordonnance
    cialis 20mg
    tabletki cialis 20mg lilly icos
    buy cialis online

  18. Your comment is awaiting moderation.

    Really loads of helpful information!
    https://www.cialisfidel.com/
    prendre cialis 40 mg
    cheap cialis
    thuoc cialis vietnam
    generic cialis

  19. Your comment is awaiting moderation.

    Very good info, Thanks a lot.
    https://www.cialisfidel.com/
    cialis drug warnings
    cialis without a doctor prescription
    is there otc cialis
    cialis 20 mg

  20. Your comment is awaiting moderation.

    Very well expressed indeed! .
    http://cialismsnntx.com/
    potenspiller cialis
    cialis 20mg
    cialis användning
    cialis generic

  21. Your comment is awaiting moderation.

    Wow many of valuable information!
    http://cialisttk.com/
    cialis the weekender drug
    cialis online
    comparacion entre cialis y levitra
    cialis without a doctor prescription

  22. Your comment is awaiting moderation.

    Thanks! Plenty of postings!

    http://cialismsnrx.com/
    cialis vedlajsie ucinky
    cialis 20 mg
    cialis take best results
    cialis 20 mg

  23. Your comment is awaiting moderation.

    You suggested that superbly!
    http://cialismsnrx.com/
    costo cialis in europa
    generic cialis
    efficacitГ© cialis 5 mg
    cialis online

  24. Your comment is awaiting moderation.

    Regards. Numerous data.

    https://www.cialisfidel.com/
    perche il cialis non ha funzionato
    cialis without a doctor prescription
    cialis na droga raia
    cialis 20 mg

  25. Your comment is awaiting moderation.

    Nicely put. Cheers.
    https://www.cialisfidel.com/
    cialis sklep online
    cialis 20 mg
    como funciona o remedio cialis
    cheap cialis

  26. Your comment is awaiting moderation.

    Thank you, Awesome stuff!
    https://www.cialismim.com/
    viagra cialis etc
    cheap cialis
    cialis wikipidia
    cialis generic

  27. Your comment is awaiting moderation.

    You said it nicely..
    https://www.cialisfidel.com/
    cialis free offers
    cialis without a doctor prescription
    what does the bathtub mean in cialis commercial
    cialis without a doctor prescription

  28. Your comment is awaiting moderation.

    Thank you, A good amount of write ups.

    http://cialismsnntx.com/
    cialis viagra yhdessä
    cheap cialis
    cialis e mal di schiena
    cialis online

  29. Your comment is awaiting moderation.

    You actually expressed it superbly.
    http://cialismsnntx.com/
    cialis and heart failure
    cialis without a doctor prescription
    cialis alcool forum
    buy cialis online

  30. Your comment is awaiting moderation.

    Whoa quite a lot of good tips.
    http://cialismsnrx.com/
    brand cialis prices
    cialis online
    medicina cialis 20 mg
    cialis without a doctor prescription

  31. Your comment is awaiting moderation.

    You actually mentioned it terrifically.
    http://cialispego.com/
    de cuantos miligramos hay cialis
    cialis 20mg
    durata cialis 10 mg
    cialis 20 mg

  32. Your comment is awaiting moderation.

    Reliable material. Thank you!
    https://www.cialismim.com/
    dosage viagra cialis levitra
    generic cialis
    cialis does not work with alcohol
    cheap cialis

  33. Your comment is awaiting moderation.

    Nicely put. Regards!
    http://cialisttk.com/
    arginina e cialis
    cialis 20mg
    vaistai potencijai cialis
    cialis without a doctor prescription

  34. Your comment is awaiting moderation.

    Awesome facts. With thanks.
    http://cialismsnntx.com/
    cách sử dụng thuốc cialis
    cialis 20 mg
    consecuencias pastilla cialis
    generic cialis

  35. Your comment is awaiting moderation.

    Useful info. Many thanks!
    https://www.cialisfidel.com/
    will cialis really work
    cheap cialis
    buying cialis in egypt
    cialis without a doctor prescription

  36. Your comment is awaiting moderation.

    This is nicely put! .
    https://www.cialisfidel.com/
    can cialis cause memory loss
    cialis generic
    controindicazioni cialis 20 mg
    cialis 20mg

  37. Your comment is awaiting moderation.

    You made the point.
    http://cialismsnrx.com/
    cialis aneurysma
    generic cialis
    how much is cialis in south africa
    cialis online

  38. Your comment is awaiting moderation.

    With thanks, I value this.
    https://www.cialisfidel.com/
    compra cialis mexico
    cialis 20mg
    cialis verzögerte wirkung
    buy cialis online

  39. Your comment is awaiting moderation.

    Kudos, Valuable stuff.
    http://cialispego.com/
    cost of cialis 20 mg
    cialis online
    cialis c20 review
    cialis without a doctor prescription

  40. Your comment is awaiting moderation.

    Nicely put, Thanks!
    http://cialispego.com/
    adenoma prostatico e cialis
    cheap cialis
    derive du cialis
    cialis 20mg

  41. Your comment is awaiting moderation.

    Awesome facts. Kudos!
    http://cialismsnntx.com/
    what pharmacy has the cheapest cialis
    cialis generic
    en que farmacia venden cialis generico
    buy cialis online

  42. Your comment is awaiting moderation.

    Cheers, Ample forum posts!

    http://cialismsnrx.com/
    erectile dysfunction while taking cialis
    buy cialis online
    verschil tussen cialis en levitra
    cialis online

  43. Your comment is awaiting moderation.

    You suggested that wonderfully.
    https://www.cialismim.com/
    daily cialis prices
    cialis online
    is cialis legal in usa
    cheap cialis

  44. Your comment is awaiting moderation.

    Beneficial info. Regards!
    https://www.cialismim.com/
    compare price of viagra cialis and levitra
    cialis online
    cialis iЕџe yarД±yor mu
    cheap cialis

  45. Your comment is awaiting moderation.

    You suggested that fantastically!
    https://www.cialismim.com/
    can cialis cause fatigue
    cheap cialis
    cialis cost at costco
    cialis generic

  46. Your comment is awaiting moderation.

    You expressed this effectively.
    https://www.cialismim.com/
    cialis 20mg vs 40mg
    cialis 20 mg
    cialis und kiffen
    cialis generic

  47. Your comment is awaiting moderation.

    Wow plenty of very good tips.
    http://cialispego.com/
    can you drink alcohol while on cialis
    cialis online
    prijs cialis 10 mg
    cialis 20 mg

  48. Your comment is awaiting moderation.

    Nicely spoken really! .
    http://cialismsnrx.com/
    cialis medication guide
    cialis without a doctor prescription
    comprar viagra cialis
    generic cialis

  49. Your comment is awaiting moderation.

    Many thanks. Numerous information.

    http://cialismsnrx.com/
    was ist cialis tadalafil
    cheap cialis
    taking cialis and alpha blockers
    cialis online

  50. Your comment is awaiting moderation.

    Awesome information. Thanks a lot!
    http://cialismsnrx.com/
    comparacion entre cialis y levitra
    cialis online
    cialis 10 mg comprimГ© pelliculГ© boГ®te de 4
    cialis 20 mg

  51. Your comment is awaiting moderation.

    Factor well considered!!
    https://www.cialisfidel.com/
    generic viagra cialis online pharmacy
    cheap cialis
    cialis sin receta argentina
    cialis 20 mg

  52. Your comment is awaiting moderation.

    You said it very well.!
    http://cialismsnntx.com/
    cialis once a day in italia
    generic cialis
    migliore tra viagra cialis levitra
    cheap cialis

  53. Your comment is awaiting moderation.

    With thanks, Quite a lot of postings.

    https://www.cialismim.com/
    exceed viagra and cialis maxman capsules
    cialis 20mg
    36 hour cialis price
    cialis generic

  54. Your comment is awaiting moderation.

    Cheers, Very good stuff!
    http://cialismsnrx.com/
    comment agit le cialis
    cialis without a doctor prescription
    using cialis for performance anxiety
    buy cialis online

  55. Your comment is awaiting moderation.

    Wow quite a lot of beneficial info!
    https://www.cialisfidel.com/
    perchГЁ prendere il cialis
    cialis online
    recetas de cialis
    cialis without a doctor prescription

  56. Your comment is awaiting moderation.

    Great posts. With thanks!
    https://www.cialismim.com/
    cialis 23 year old
    buy cialis online
    donde puedo comprar cialis en monterrey
    cialis without a doctor prescription

  57. Your comment is awaiting moderation.

    Nicely put, Appreciate it.
    https://www.cialismim.com/
    most common dose of cialis
    cheap cialis
    cialis and imdur
    generic cialis

  58. Your comment is awaiting moderation.

    You stated that really well!
    http://cialismsnrx.com/
    cialis aktiv
    cialis 20 mg
    telmisartan and cialis
    buy cialis online

  59. Your comment is awaiting moderation.

    You said it perfectly..
    http://cialismsnrx.com/
    cialis in russia
    generic cialis
    cialis bathtubs meaning
    cialis without a doctor prescription

  60. Your comment is awaiting moderation.

    With thanks! Fantastic information!
    https://www.cialismim.com/
    tiempo de duracion del cialis
    buy cialis online
    cialis o levitra diferencias
    cialis generic

  61. Your comment is awaiting moderation.

    Very good content. Appreciate it.
    http://cialispego.com/
    cialis che si scioglie in bocca
    cheap cialis
    cialis 10mg filmtabletten bestellen
    cialis 20 mg

  62. Your comment is awaiting moderation.

    Whoa lots of very good advice.
    http://cialispego.com/
    cialis y toronja
    cheap cialis
    cialis birra
    buy cialis online

  63. Your comment is awaiting moderation.

    This is nicely said. !
    http://cialispego.com/
    cialis case study
    cheap cialis
    cialis price in south africa
    generic cialis

  64. Your comment is awaiting moderation.

    With thanks, Wonderful stuff!
    https://www.cialismim.com/
    para que sirve la pastilla cialis tadalafil
    cialis 20mg
    cialis black dangerous
    cialis without a doctor prescription

  65. Your comment is awaiting moderation.

    With thanks! A lot of information.

    http://cialismsnntx.com/
    is cialis scored
    cialis 20mg
    cialis nabavka
    cialis 20mg

  66. Your comment is awaiting moderation.

    Regards, I like it.
    http://cialismsnntx.com/
    maximum safe cialis dosage
    cialis online
    compare cialis levitra and viagra
    cialis online

  67. Your comment is awaiting moderation.

    Thank you, Numerous advice.

    http://cialispego.com/
    cialis prices in new zealand
    buy cialis online
    side effects of taking cialis daily
    cialis online

  68. Your comment is awaiting moderation.

    Amazing information. Appreciate it.
    http://cialismsnntx.com/
    levitra cialis o viagra cual es mejor
    buy cialis online
    diferencia entre viagra y cialis y levitra
    buy cialis online

  69. Your comment is awaiting moderation.

    Fantastic material. Cheers!
    http://cialismsnrx.com/
    urology viagra v cialis
    cialis generic
    viagra levitra cialis karЕџД±laЕџtД±rma
    cialis 20mg

  70. Your comment is awaiting moderation.

    You said it perfectly!
    http://cialispego.com/
    achat cialis andorre
    buy cialis online
    is cialis super active real
    buy cialis online

  71. Your comment is awaiting moderation.

    Regards, Plenty of tips!

    http://cialisttk.com/
    cialis trouble de la vision
    generic cialis
    oldies music cialis commercial song
    cialis without a doctor prescription

Leave a Reply

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