图像加密和解密 [英] Image Encryption and decryption

查看:136
本文介绍了图像加密和解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想用C#加密图像文件.如何获得每个像素,如何加密每个像素,如何解密每个像素?如何从加密的图像中获取原始图像.

Hi,

I want to encrypt a image file in C#. How to get each pixels, How to encrypt each pixels, How to decrypt each pixels? How to get the orginal image from the encrypted image.

推荐答案

如果要加密图像,强烈建议您不要对每个像素进行加密.
更好的方法是将图像作为原始二进制数据处理并对此进行加密:

内容:
图片->保存到流->将流写入CryptoStream->随时随地保存CryptoStream

反之则相反.

也许这篇文章这篇文章 [ [
If you want to encrypt your image, I highly recommend you not encrypting each pixel.
The better way is to handle the image as raw binary data and encrypt this:

Encrpytion:
Image -> Save To Stream -> Write Stream to CryptoStream -> Save CryptoStream wherever you want

The decryption is the other way round.

Maybe this article this article[^] can help you.

The only problem is, that you cannot display the encrypted data as image since it is (nearly random) binary data.
Maybe this[^] could help then.


这篇关于图像加密和解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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