Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: How to write a Bitmap file

Reply
Thread Tools

Re: How to write a Bitmap file

 
 
William Cleveland
Guest
Posts: n/a
 
      06-25-2003
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


 
Reply With Quote
 
 
 
 
D. Rush
Guest
Posts: n/a
 
      09-29-2004
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/fid7537D5C...?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

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Help! How can I draw a bitmap only with BITMAP information! xqggz C++ 1 06-19-2007 03:07 PM
convert a bitmap file into a jpg file ? MoshiachNow Perl Misc 2 05-03-2007 02:02 PM
write a bitmap using python lyuan Python 5 06-06-2004 03:27 AM
Masked bitmap from bitmap Gandalf Python 0 01-29-2004 09:41 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57