 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
William Cleveland Guest
|
Posted: Wed Jun 25, 2003 4:09 am Post subject: Re: How to write a Bitmap file |
|
|
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:
| Quote: | 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
|
|
|
| Back to top |
|
 |
D. Rush Guest
|
Posted: Wed Sep 29, 2004 10:44 pm Post subject: Re: How to write a Bitmap file |
|
|
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" <WCleveland (AT) Ameritech (DOT) Net> wrote
| Quote: | 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
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|