Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more: , +
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.
Posted

1 solution

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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900