In digital images, each pixel represents a color, typically defined by its red, green, and blue (RGB) components. Pixel manipulation involves altering these values to modify the appearance of the image.
- Concept: Swapping pixels involves randomly exchanging the positions of pixels in the image.
- Logic: This process scrambles the image, making it appear different without altering the pixel values themselves.
- Implementation: Randomly swap pixel positions based on a cryptographic key.
Mathematical operations can be applied to the RGB values of pixels to further alter the image.
- Concept: Addition and subtraction operations add or subtract a constant value from each RGB component of every pixel.
- Logic: This shifts the color values, changing the overall appearance of the image.
- Implementation: Add a key to each pixel’s RGB values during encryption and subtract it during decryption.
- Load Image: Load the input image.
- Pixel Manipulation: Swap pixel positions and apply mathematical operations based on a cryptographic key.
- Save Encrypted Image: Save the modified image to a new file.
- Load Encrypted Image: Load the previously encrypted image.
- Reverse Pixel Manipulation: Undo the pixel swaps and mathematical operations using the same cryptographic key.
- Save Decrypted Image: Save the restored image to a new file.