Re: How to write a Bitmap file

Discussion in 'C++' started by William Cleveland, Jun 25, 2003.

  1. A portable bitmap file (.pbm, usually) is a few header lines, followed
    by a raw, two-dimensional array of bytes. Using system IO, you can
    just write() your array of bytes with a single call, after you write
    the header lines (probably with a sprintf call or the IO Streams
    equivilant, followed by a single write() call for that buffer).

    If you're talking about the Windows .bmp format, it's not really a
    bitmap. It's complicated enough that you'll probably want to find
    a library.

    Bill


    Yicheng Li wrote:
    > Hi, I've got an array of byte values (300 by 300) that I'm trying to
    > output as a bitmap file. I'm on the Windows 2000 platform, and I was
    > hoping for some kind of API or library where I could just create a
    > bitmap file. Is there anything like this, or am I pretty much going
    > to have to manually write the byte by byte.
    >
    > Thanks in advance,
    > YL
    William Cleveland, Jun 25, 2003
    #1
    1. Advertising

  2. William Cleveland

    D. Rush Guest

    Here's some code that writes a bitmap. You can integrate the BitmapManager
    class to build and save the bitmap pixel by pixel.

    http://www.koders.com/cpp/fid7537D5C83DD56B396E00399B7636CFA11AB28FF4.aspx?s=2d bmp save

    DR

    "William Cleveland" <> wrote in message
    news:...
    > A portable bitmap file (.pbm, usually) is a few header lines, followed
    > by a raw, two-dimensional array of bytes. Using system IO, you can
    > just write() your array of bytes with a single call, after you write
    > the header lines (probably with a sprintf call or the IO Streams
    > equivilant, followed by a single write() call for that buffer).
    >
    > If you're talking about the Windows .bmp format, it's not really a
    > bitmap. It's complicated enough that you'll probably want to find
    > a library.
    >
    > Bill
    >
    >
    > Yicheng Li wrote:
    > > Hi, I've got an array of byte values (300 by 300) that I'm trying to
    > > output as a bitmap file. I'm on the Windows 2000 platform, and I was
    > > hoping for some kind of API or library where I could just create a
    > > bitmap file. Is there anything like this, or am I pretty much going
    > > to have to manually write the byte by byte.
    > >
    > > Thanks in advance,
    > > YL

    >
    D. Rush, Sep 29, 2004
    #2
    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. Stimp
    Replies:
    1
    Views:
    322
    Kevin Spencer
    Oct 22, 2004
  2. Gandalf

    Masked bitmap from bitmap

    Gandalf, Jan 29, 2004, in forum: Python
    Replies:
    0
    Views:
    577
    Gandalf
    Jan 29, 2004
  3. lyuan

    write a bitmap using python

    lyuan, Jun 5, 2004, in forum: Python
    Replies:
    5
    Views:
    815
    Paul McGuire
    Jun 6, 2004
  4. xqggz
    Replies:
    1
    Views:
    417
    Victor Bazarov
    Jun 19, 2007
  5. MoshiachNow

    convert a bitmap file into a jpg file ?

    MoshiachNow, May 3, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    87
    MoshiachNow
    May 3, 2007
Loading...

Share This Page