locked
Drawing a text over png image ? RRS feed

  • Question

  • User-42864417 posted

    Hi all

    I want to know if i can draw some text over a png image ?

    suppose i have image.png file i want to write my name on the picture, how can i do this?

    Best regards,
    Ahmed :)

    Saturday, February 4, 2006 3:03 PM

All replies

  • User-1372641848 posted

    Yes you can, Its same as drawing text on any other image.

    Create Instance of Bitmap object

    Bitmap bitmap = new Bitmap("pathtoyourimage");

    Create Graphics object

    Graphics g = Graphics.FromImage(bitmap);

    Draw String

    g.DrawString("Your string", new Font("verdana",12,GraphicsUnit.Pixel),Brushes.Black,10,10);

    there are lot of examples on net which shows how to do such things.

     

    Sunday, February 5, 2006 11:01 AM
  • User-42864417 posted

    Thnkx Jigar

    And i want 2 ask if i can make the output of the file is a picture, like this is php:

    header("Content-Type: image/png");
    imagepng($image);


    imagedestroy($img_fond);
    imagedestroy($image
    );
    ?>
    the file retun an image

    Best regards,
    Ahmed

    Sunday, February 5, 2006 1:21 PM
  • User-1372641848 posted

    If bitmap is your Bitmap Instance then

    Response.Clear();

    Response.ContentType = "image/png";

    bitmap.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Png);

    Response.End();

    Sunday, February 5, 2006 3:21 PM
  • User-42864417 posted

    Thnx Jigar very much,

    But can any one provide to me a full code (aspx file) to show how to get some data from xml file and write them over a png image

    My best regards to u all,

    Wednesday, February 8, 2006 3:51 AM