how to save bitmap

This is a discussion on how to save bitmap within the C# Programming forums, part of the General Programming Boards category; hi, i want to save bitmap data from stream. how can i do it? can i get some code? thx...

  1. #1
    sgh
    sgh is offline
    Registered User
    Join Date
    Apr 2008
    Posts
    58

    how to save bitmap

    hi, i want to save bitmap data from stream.
    how can i do it?
    can i get some code?
    thx

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What sort of bitmap, from what sort of stream? What bitmap format do you want to save it as? What platform?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    I assume you mean save the bitmap to a file.

    You'll need the following Namespaces:

    Code:
    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.IO;
    And then maybe this will help:

    Code:
    public static void BitmapToFile(Bitmap image, String filename)
    {
        MemoryStream stream = new MemoryStream();
        image.Save(stream, ImageFormat.Bmp);
        File.WriteAllBytes(filename, stream.ToArray());
        stream.Close();
    }

  4. #4
    sgh
    sgh is offline
    Registered User
    Join Date
    Apr 2008
    Posts
    58
    i just got it.
    dont worry.
    thank u, theoobe

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. save webpage? some save some not
    By kryptkat in forum Tech Board
    Replies: 3
    Last Post: 06-07-2005, 10:21 AM
  2. OpenGL -- Bitmaps
    By HQSneaker in forum Game Programming
    Replies: 14
    Last Post: 09-06-2004, 05:04 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. bitmap not going onto screen
    By stallion in forum Windows Programming
    Replies: 4
    Last Post: 02-22-2003, 10:07 AM
  5. Saving a bitmap.
    By jdinger in forum Game Programming
    Replies: 4
    Last Post: 05-01-2002, 02:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21