bitmap from memorystream has altered pixels

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



// at server, bitmapStream is a MemoryStream that i put together by
converting a gif file from indexed pixel format to raw (A)RBG format
Bitmap carrierBitmap = new Bitmap(bitmapStream);

// store encrypted data at the 'R' element of pixels at various
positions of carrierBitmap (i am doing image steganography)

// save the worked up bitmap back to memory stream
bitmapStream.Flush();
carrierBitmap.Save(bitmapStream,
System.Drawing.Imaging.ImageFormat.Png);

//******* examine pixels of the first 10 worked up positions of the
result bitmap (to be compared with the one recovered by the client
later)

// convert memory stream to byte array
byte[] embeddedBuf = bitmapStream.ToArray();

// send byte array to pocket PC client

// recover the memory stream at client

Bitmap carrierBitmap = new Bitmap(bitmapStream);

//******* examine pixels of the first 10 positions of the recovered
bitmap, and they're different, not just the R value that i need to
recover the original data with, but G and B too

can someone shed some light about why and how i can recover the exact
bitmap sent by the server?

.



Relevant Pages

  • Re: memory leak
    ... ArgumentException on Full Framework) when I have a ton of virtual memory ... "new Bitmap" line. ... Dispose is not a required call - it is optional. ... you are done with those resources. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: One Thing I Noticed - Line Too Long
    ... > in memory plus a further bitmap, or "extra space on the Form wasting ... Turning on autoredraw keeps a copy of what's on the screen in memory. ... are drawing a bitmap to the screen and have the bitmap in memory then you ... > Picture Box and one Command Button. ...
    (microsoft.public.vb.general.discussion)
  • Re: memory leak
    ... Adding GC.Collectcauses the memory to drop, ... Now do you still agree that the GC will cleanup Bitmap objects? ... Dispose is not a required call - it is optional. ... done with those resources. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: How to convert image from Format1bppIndexed to Format24bppRgb?
    ... //image you just need to create a bitmap of the correct size ... > case of conversion to any indexed type you need to understand the pixel ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... >>> The size of the image file has no bearing on the amount of memory you ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: memory leak
    ... Adding GC.Collectcauses the memory to drop, ... GC.Collect in the exception handler, ... Now do you still agree that the GC will cleanup Bitmap objects? ... Dispose is not a required call - it is optional. ...
    (microsoft.public.dotnet.framework.compactframework)