Skip to content

Hides a message in the least-significant-bit of a PNG image's color channels

License

Notifications You must be signed in to change notification settings

sourcedennis/png-steganography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

png-steganography

This repository contains a Python script that stores an ASCII message in the least significant bit of the pixel color channels. It is very difficult to perceive the message in the visual image. However, when a message is known to be present, it can be recovered by analysing the image's pixel values. Hence, it is hidden in plain sight; which is what steganography entails.

Explanation

Consider an RGB image of size 3x2. As there are 6 pixels, each with 3 color channels, a total of 18 bits can be stored. Assume a bitvector of length 8 will be stored in the image. The message is divided into its 8 individual bits (represented by bit variables a-h below). These bits replace the existing least significant bits in the color channels. This is depicted below.

Explanation

Example

Input Output
Input image Output image

The difference between these images is not observable with the human eye. Yet, inspection of the pixel values in a graphics editor exposes small differences.

Running

Running requires Python 3, with the following Python libraries:

  • Pillow image library (pip install pillow)
  • bitarray (pip install bitarray)

Then simply run with (where my python references python3):

python png_hide.py

License

BSD-3 - See the LICENSE file

This license does not apply to the example_input.png and example_output.png files. Those images are taken (and adapted) from the Big Buck Bunny movie from the Peach open movie project by the Blender Foundation, and are licensed under CC BY 3.0.

About

Hides a message in the least-significant-bit of a PNG image's color channels

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages