Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / June 2007

Tip: Looking for answers? Try searching our database.

bitmap from memorystream has altered pixels

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
margec3 - 29 Jun 2007 17:42 GMT
// 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?
margec3 - 29 Jun 2007 17:48 GMT
this is exactly how i converted a gif file from indexed pixel format
to raw (A)RBG format:

public static MemoryStream convertBitmap(string fileName)
{
           Bitmap myImage = new Bitmap(fileName);

           int imageSize = myImage.Width * myImage.Height;
           MemoryStream ms = new MemoryStream(imageSize);
           myImage.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);

           Bitmap resultImage = new Bitmap(myImage.Width,
myImage.Height);
           Graphics resultG = Graphics.FromImage(resultImage);
           resultG.DrawImage(myImage, 0, 0);

           imageSize = myImage.Height * myImage.Width; // # of pixels
           ms.Flush();
           resultImage.Save(ms,
System.Drawing.Imaging.ImageFormat.Png);

           return ms;
}

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.