locked
Load Bitmap obj from System.Drawing.Image RRS feed

  • Question

  • User1119954915 posted

    Hi... I am trying to pass into a function a System.Drawing.Image object, and in that function, create a new Bitmap object to maipulate with text and watermarking

    Problem is I cannot figure out how to go from Drawing.Image to a Stream.....  the image is not saved to the file system yet, so i cannot say:

    bmp.FromFile

    i have a feeling the ".FromStream" method is what i am after since the Image being passed in is from memory, but i cannot get the conversion right....

    Monday, February 20, 2006 8:02 PM

All replies

  • User-1372641848 posted

    System.Drawing.Image is an abstract base class that provides functionality for the System.Drawing.Bitmap,  Most of the properties and method of Bitmap object are inherited from Image you might be able to perform same things to Image.

    for example for Drawing text on Image

    Graphics g = Graphics.FromImage(yourImageObj);

    g.DrawString("test", new Font("Verdana", 2.00), Brushes.Black, new Point(10, 10)) ;

    Or If you need your own copy of image out of original then.

    Bitmap myCopyofImage = new Bitmap(yourImageObj);

     

    Monday, February 20, 2006 8:35 PM
  • User1119954915 posted
    Thank you much... that helped and i now have it working  :-)
    Monday, February 20, 2006 11:02 PM