从修改后的字节数组重绘图像 [英] image redrawing from the modified byte array

查看:84
本文介绍了从修改后的字节数组重绘图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是吉萨,
我试图将图像读入字节数组并修改此字节数组.这我能够正确地做到.但是,当我尝试从此字节数组重绘图像时,出现错误..我知道问题所在...在这里,我尝试向图像添加秘密信息并重绘与原始图像没有太大区别的图像.

memorystream ms =新的memorystream(bt); //bt是hving的字节数组
//修改后的图片数据,例如bt [0] = bt [0] + 5;
picturebox2.image = image.fromstream(ms); //错误:无效的参数

Hi this is geetha,
i am trying to read the image into byte array and modifying this byte array. this i am able to do correctly. but when i try to redraw the image from this byte array it is giving an error.. my i know the problem... Here I am trying to add secrete information to the image and redraw the image with no much difference from the original.

memorystream ms=new memorystream(bt); // bt is the byte array hving
//modified image data like bt[0]=bt[0]+ 5;
picturebox2.image=image.fromstream(ms); // error: invalid argumen

推荐答案

这实际上是您第二次询问相同的问题.

两次,成员都建议您对字节数组进行的更改破坏了它.我会做三遍.

我有一些问题:

1.您可以在改善"图像之前正确地重绘"图像吗?
2.您尝试对图像进行修改后的操作.

如果对1.的回答为否",则无论如何您的图像都已损坏.如果是,则仅确认您正在破坏图像.

对于2.如果您告诉我们您要做什么,我们也许可以建议其他方法.

顺便说一句:查看已注释掉的代码行,您会发现图像的标头部分必须正确才能将其识别为图像.猜猜此标头部分的住处!没错,在数据的开头,正是bt[0]所困扰的地方.
This is the second time that you have asked, essentially, the same question.

Both times, members have suggested that the changes you are making to the byte array are corrupting it. I will make it three times.

I have some questions:

1. Are you able to ''redraw'' the image correctly before you ''improve'' it?
2. What you trying to do to the image with your modifications.

If the answer to 1. is no, then you have a corrupt image anyway. If yes, then that merely confirms that you are corrupting the image.

For 2. if you tell us what you are trying to do we may be able to suggest other ways to do it.

BTW: Looking at the line of code that you have commented out, you are aware that images have a header section which has to be correct for it to be recognised as an image. Guess where this header section lives! That''s right, at the beginning of the data, exactly where bt[0] is messing about.


sursangeetha写道:
sursangeetha wrote:

///修改后的图像数据,例如bt [0] = bt [0] + 5;

//modified image data like bt[0]=bt[0]+ 5;



1.您要修改字节数组的逻辑是什么?
2.修改图像字节数组的原因是什么?之后有什么用吗?

顺便说一句:看起来您正在尝试将整数添加到某个字节数组.它们不是整数(不是10的基数)!可能导致数组损坏.



1. On what logic you are modifying the byte array?
2. Whats the reason behind modifying an image byte array. Is it of any use after it?

Btw: Looks like you are trying to add an integer to a certain byte array. They are not integers(=> not a base 10)! Probably leading to a corrupt array.


这篇关于从修改后的字节数组重绘图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆