Remove bmp header to encrypt

北战南征 提交于 2019-12-06 07:49:09

byte[] is an object, so you don't want to initialize a variable of that type to null. You probably want to initialize Header like this:

byte[] Header = new byte[54];

and picture to a new byte[] with length at least equal to the actual image data length, like this:

byte[] picture = new byte[pictureFull.Length - 54];

Then you can copy things to them.

Try that instead of FOR:

byte[] pictureFull = ms.ToArray();
byte[] Header = pictureFull.Take(54);
byte[] picture = pictureFull.Skip(54);

and continue with encryption. PS Don't forget add System.Linq namespace

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!