468,556 Members | 2,387 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,556 developers. It's quick & easy.

Creating bmp file from VB.NET

I have a utility that captures a signature on a handheld device and stores
it as as string containing a series of points. I want to recreate this
signature as a bmp file using VB.NET code. To do this, I have created a
bitmap object using the following code
Dim bmpSignature as Bitmap
bmpSignature = New BitMap(240, 80)
and I then use the graphics object to replot the points on the new bitmap,
and save it using
bmpSignature.Save("C:\Signature.bmp")
If I look at the saved file in XP by right clicking and selecting Preview, I
can see the signature so the data looks OK. My problem is reading the file
in another application (specifically Crystal Reports XI, but Paint and Paint
Shop Pro cannot read it either) - I just see a black box of the right size.
After looking on the net, I have come to the (possibly incorrect) conclusion
that something is wrong in the header of the file that is causing these
programs not to be able to read it. I have a VB6 utility to read the header
of a bmp file, the file that my VB app has saved doesn't appear to contain
sensible values in any of the fields. Does the Save method of the VB bitmap
object create a file with a header, and if not how can I create one and then
add my data to the end of it? Most sample code that I have seen of this type
is in C++, and I am not much of a C++ programmer, so any help on how to do
this in VB.NET would be appreciated. Thanks in advance.
Jan 12 '07 #1
3 3441
Andy,

Crystal Reports has a nasty habit of requiring a particular bit depth in the
..bmp's it can display. You MUST save the .bmp as a 24-bit .bmp for Crystal
Reports to display it properly.

"Andy Baker" <ab****@NOSPAMvanputer.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
If I look at the saved file in XP by right clicking and selecting Preview,
I can see the signature so the data looks OK. My problem is reading the
file in another application (specifically Crystal Reports XI, but Paint
and Paint Shop Pro cannot read it either) - I just see a black box of the
right size. After looking on the net, I have come to the (possibly
incorrect) conclusion that something is wrong in the header of the file
that is causing these programs not to be able to read it. I have a VB6
utility to read the header of a bmp file, the file that my VB app has
saved doesn't appear to contain sensible values in any of the fields. Does
the Save method of the VB bitmap object create a file with a header, and
if not how can I create one and then add my data to the end of it? Most
sample code that I have seen of this type is in C++, and I am not much of
a C++ programmer, so any help on how to do this in VB.NET would be
appreciated. Thanks in advance.


Jan 14 '07 #2
Hi Bruce

Thanks for that. I have solved it by creating an empty 24-bit ,bmp in Paint
Shop Pro, and writing my signature onto that. Crystal Reports now reads it
OK.

"Bruce W. Darby" <kr****@comcast.netwrote in message
news:Bd******************************@comcast.com. ..
Andy,

Crystal Reports has a nasty habit of requiring a particular bit depth in
the .bmp's it can display. You MUST save the .bmp as a 24-bit .bmp for
Crystal Reports to display it properly.

"Andy Baker" <ab****@NOSPAMvanputer.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
>If I look at the saved file in XP by right clicking and selecting
Preview, I can see the signature so the data looks OK. My problem is
reading the file in another application (specifically Crystal Reports XI,
but Paint and Paint Shop Pro cannot read it either) - I just see a black
box of the right size. After looking on the net, I have come to the
(possibly incorrect) conclusion that something is wrong in the header of
the file that is causing these programs not to be able to read it. I have
a VB6 utility to read the header of a bmp file, the file that my VB app
has saved doesn't appear to contain sensible values in any of the fields.
Does the Save method of the VB bitmap object create a file with a header,
and if not how can I create one and then add my data to the end of it?
Most sample code that I have seen of this type is in C++, and I am not
much of a C++ programmer, so any help on how to do this in VB.NET would
be appreciated. Thanks in advance.



Jan 15 '07 #3
You're most welcome, Andy :)

"Andy Baker" <ab****@NOSPAMvanputer.comwrote in message
news:45**********************@ptn-nntp-reader02.plus.net...
Hi Bruce

Thanks for that. I have solved it by creating an empty 24-bit ,bmp in
Paint Shop Pro, and writing my signature onto that. Crystal Reports now
reads it OK.

"Bruce W. Darby" <kr****@comcast.netwrote in message
news:Bd******************************@comcast.com. ..
>Andy,

Crystal Reports has a nasty habit of requiring a particular bit depth in
the .bmp's it can display. You MUST save the .bmp as a 24-bit .bmp for
Crystal Reports to display it properly.

Jan 19 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jeremy Langworthy | last post: by
1 post views Thread by Inpreet | last post: by
2 posts views Thread by George Marsaglia | last post: by
15 posts views Thread by Carlos Lozano | last post: by
12 posts views Thread by Mats Lycken | last post: by
15 posts views Thread by David Thielen | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.