Re: Image <-> Byte Array



Ivan Debono wrote:
Hi all,

I have the following 2 functions:

1. ConvertToPicture: converts a byte array to a picture
2. ConvertToByteArray: converts a picture to a byte array

In ConvertToByteArray, there are a few lines of test code (commented):
When I save the original oImage to a file, it's about 3.5MB and is a
valid bmp. But when I convert the byte array back to an image, the
temporary 'pic.tmp' file is 11.5MB and is not a valid bmp.

Since that's about 3x too large, I'm suspicious of this line:

ReDim PicBits(1 To BytesPerLine * PicInfo.bmHeight * 3) As Byte

What is the "* 3" doing here that hasn't already been done when you compute BytesPerLine?

--

Jim Mack
MicroDexterity Inc
www.microdexterity.com
.


Loading