bitmap onto a webpage

Discussion in 'ASP .Net' started by Microsoft, Aug 15, 2003.

  1. Microsoft

    Microsoft Guest

    I have a need to display a bitmap (chart) that has been created in code. In
    the Windows I just place it in a picturebox. But no luck with a Web page
    and I would like to be able to do it without writing the bmp to a file and
    then putting it back into the web page.

    Does anyone have an idea around this.

    Bob Brand
    Microsoft, Aug 15, 2003
    #1
    1. Advertising

  2. Microsoft

    vMike Guest

    You can look into system.drawing.image
    save(Response.OutputStream, ImageFormat.Jpeg) method. You might want a bmp
    format, but this "writes" the image out to a memory stream instead of disk.

    "Microsoft" <> wrote in message
    news:...
    > I have a need to display a bitmap (chart) that has been created in code.

    In
    > the Windows I just place it in a picturebox. But no luck with a Web page
    > and I would like to be able to do it without writing the bmp to a file and
    > then putting it back into the web page.
    >
    > Does anyone have an idea around this.
    >
    > Bob Brand
    >
    >
    vMike, Aug 15, 2003
    #2
    1. Advertising

  3. You need to create an ASP.Net page to write the image to the browser. The
    page can take a Bitmap object, and invoke the Save method to write the
    Bitmap to the Response.OutputStream. The example below writes the image in
    Jpeg Format. Note that you must set the Response.ContentType to the
    appropriate MIME Type for the ImageFormat you use. This informs the browser
    what MIME type it's getting, as the file extension (.aspx) won't help:

    Response.ContentType = "image/jpg";
    ImageObject.Save(Response.OutputStream, ImageFormat.Jpeg);

    You can then reference your ASP.Net page in an Image tag in any page;

    <img src="ShowImage.aspx">

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "Microsoft" <> wrote in message
    news:...
    > I have a need to display a bitmap (chart) that has been created in code.

    In
    > the Windows I just place it in a picturebox. But no luck with a Web page
    > and I would like to be able to do it without writing the bmp to a file and
    > then putting it back into the web page.
    >
    > Does anyone have an idea around this.
    >
    > Bob Brand
    >
    >
    Kevin Spencer, Aug 15, 2003
    #3
  4. Microsoft

    Microsoft Guest

    Jos

    Thanks you did the trick.

    Bob Brand
    "Jos" <> wrote in message
    news:...
    > Microsoft wrote:
    > > I have a need to display a bitmap (chart) that has been created in
    > > code. In the Windows I just place it in a picturebox. But no luck
    > > with a Web page and I would like to be able to do it without writing
    > > the bmp to a file and then putting it back into the web page.
    > >
    > > Does anyone have an idea around this.
    > >
    > > Bob Brand

    >
    > Creating graphics on the fly, look here:
    > http://www.15seconds.com/issue/020924.htm
    >
    > --
    >
    > Jos Branders
    >
    >
    Microsoft, Aug 15, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gandalf

    Masked bitmap from bitmap

    Gandalf, Jan 29, 2004, in forum: Python
    Replies:
    0
    Views:
    580
    Gandalf
    Jan 29, 2004
  2. Replies:
    1
    Views:
    421
  3. xqggz
    Replies:
    1
    Views:
    419
    Victor Bazarov
    Jun 19, 2007
  4. Paul
    Replies:
    14
    Views:
    843
    Alexey Smirnov
    Jun 19, 2008
  5. Replies:
    1
    Views:
    92
    kaeli
    Mar 4, 2005
Loading...

Share This Page