Skip to main content

A package for Image steganography

Project description

Image Steganography


Table of Contents

  1. General Info
  2. Technologies
  3. Example
  4. FAQs

General Info


This project deals with hiding text message inside a image. Also called as Image Steganography. It is extremely useful technique for conceling text messages. In this project there are two function namely:

  • 'encode' which encode the entered text to an also image entered by a user.
  • 'decode' which decodes the text from the image which is previously encoded by the encode function.

Technologies


A list of libraries used within the project:

Example


Example to encode the text message to image

from ImageStega import ImageStega

image = ImageStega().encode(path, encode_text)

# path(str) : "path of the image" 
# encode_text(str) : "Text to be encoded in the image"

Example to decode the text from the image

from ImageStega import ImageStega

decoded_text = ImageStega().decode(path) 

# path(str) : path of the image which was previously encoded with the message.

FAQs


A list of frequenctly asked questions

  1. What is Image steganography?
    Steganography is the technique of hiding secret data within an ordinary, non-secret, file or message in order to avoid detection. More information can be found on this Wikipedia page.

  2. Where can I use this package?
    This tool is used to craftfully hide the data in images. So this package can be used to hide secret text messages by encoding them in images to maintain the secrecy.

  3. How does this algorithm works?
    Let us consider a 3 * 3 RBG image for understanding the algorithm. The image consists of 3 channel and heigh and weidth equal to 3. Thus 3 * 3 * 3 = 27 values, with each value ranging from 0-255(pixel value). For instance consider. We are interested in storing the character 'H' in this image. In the encode function the H is converted into binary value which is '01001000'. Each ASCII character can be represented by 8-bit binary number which is saved in the image.
    Consider 3 pixel values p1, p2 and p3 as (10,200,35), (26,65,98), (100,139,35) respectively.
    If the bit-value to be saved is 0 the pixel value is changed to even and if 1 its converted to odd. Thus in our example, the pixel value P1, P2 and P3 changes to (10,201,36), (26,65,98), (100,140,36). If the pixel value is odd but the value to be stored is 0, then the pixel value is increased by one. Same is the case with storing 1. In this way the txt message is stored in the form of 0s and 1s string in the image.
    In the decode function, the pixel values are erad one by one, and then if its odd it is taken as 1 else 0. This is done till the algorithm encounter STOP character. Once is encounters the STOP character, it terminates the program and returns the decoded text message.
    This STOP values is ~(tilda) in our case. So if your message consists of ~ character then the decoder will only read till that value. This is only drawback of this code.

  4. How many characters can I save in a image?
    Considering you have a RGB image with 1024 * 1024 resolution, you can encode upto (1024 * 1024 * 3 - 8) / 8 = 393215 characters. The 8 subtracted represents the bits reuiqred for STOP character.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TextStega-0.1.1.tar.gz (5.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page