Adding some text to an image but not on the image

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • almurph@altavista.com

    Adding some text to an image but not on the image

    Hi,

    Hope you can help me with one please. I import an image and
    display it on a picture box control. I then have functionality change
    its size (code included below).
    Now I need to add some text *not* on image but beside the image,
    like an area to the side of the image say but not actually on the
    image (likn on a lable that can be added to the image to form kind of
    a new image).
    Problem is though I dont know how to do this (in fact, I dont even
    know how to add text to the image itself). So can anyone help me
    please? Any comments/suggestions/hints or code samples to get me
    started would be most appreciated.

    Many thanks,
    Al.


    ***** BEGIN CODE - THIOS JUST CHANGES SIZE OF IMAGE *****
    //Firstly open the file into an image object
    System.Drawing. Image img = Image.FromFile( fileName);


    //Convert to bitmap with correct dimensions:
    System.Drawing. Image newSizeImage = new Bitmap(img, 440, 60);


    //Now convert the bitmap to a.gif
    reSizeImage.Sav e("a.gif", System.Drawing. Imaging.ImageFo rmat.Gif);


    ****** END CODE ******


  • Peter Morris

    #2
    Re: Adding some text to an image but not on the image

    Create a new bitmap the size of the original + the size of the text you want
    to add. Then do

    Graphics canvas = Graphics.FromBi tmap(MyNewBitma p);
    using (canvas)
    {
    Draw the original bitmap onto the canvas
    Write your text out to the canvas
    }

    This is only useful if you want to save the image. If you want only to
    display it then just use a picture box + a label.


    Comment

    • almurph@altavista.com

      #3
      Re: Adding some text to an image but not on the image

      On Feb 20, 11:51 am, "Peter Morris"
      <peter[dot]morris(at)capab leobjects.comwr ote:
      Create a new bitmap the size of the original + the size of the text you want
      to add.  Then do
      >
      Graphics canvas = Graphics.FromBi tmap(MyNewBitma p);
      using (canvas)
      {
          Draw the original bitmap onto the canvas
          Write your text out to the canvas
      >
      }
      >
      This is only useful if you want to save the image.  If you want only to
      display it then just use a picture box + a label.
      Thanks for the reply Peter.

      Comment

      Working...