谁能告诉我您是否知道 WM 6 的位图和隐写术存在问题?
我正在做一个项目,我必须在位图中隐藏数字签名。该算法完美无缺,因为直到我将图像放在内存中,位图才包含修改后的字节。但是在我保存图像(Bitmap.Save())并重新打开图像之后,这些字节就会丢失。当我说丢失时,我的意思是它们是拍摄照片时的原始字节。
谢谢你。
这是保存方法:
{
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");
}
}
}
}
和开放方法
{
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");
}
}
}