Hello,
can anyone tell me if you know to be a problem with Bitmap and steganography for WM 6?
I am working on a project and i have to hide a digital signature in a bitmap. The algorithm works perfect, as in untill i have the image on the memory the bitmap contains the modified bytes. But after i save the image (Bitmap.Save()) and I reopen the image, than those bytes are lost. When i say lost i mean they are the orriginal bytes from when the picture was taken.
Thank you.
here is the Save method:
{
if (miSave.Enabled == false)
{
MessageBox.Show("Error, no image is opened. ", "Save Error");
}
else
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Bitmap|*.bmp|JPEG|*.jpg";
if (sfd.ShowDialog() == DialogResult.OK)
{
if (sfd.FileName != "")
{
Bitmap origImage = pictureBox.GetBitmap();
///just a test to see that the bytes are the modified ones..and they are
byte[] origImageByte = ImageProcessing.ConvertBitmapToByteArray(origImage, origImage.Height * origImage.Width +54);
origImage.Save(sfd.FileName, formatOfImage);
MessageBox.Show("Succesfully ", "Image Saved");
}
}
}
}
and the open method
{
if (pictureBox.Visible == false)
{
try
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Bitmap|*.bmp|JPEG|*.jpg";
if (dlg.ShowDialog() == DialogResult.OK)
{
Bitmap img = new Bitmap(dlg.FileName);
initialSize.Width = img.Width;
initialSize.Height = img.Height;
imageOpened();//this just does does some enabling buttons nothing more
pictureBox.SetBitmap(img, pixelSize);
pictureBox.ShowImage(img);
trackBar.TrackBarPosition(lblMinVal, lblMaxVal, this.Size);
}
}
catch
{
DialogResult res = MessageBox.Show("Failed loading image");
}
}
}