

{"id":107491,"date":"2022-03-16T09:00:56","date_gmt":"2022-03-16T03:30:56","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=107491"},"modified":"2026-06-01T11:56:25","modified_gmt":"2026-06-01T06:26:25","slug":"python-image-steganography-project","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/","title":{"rendered":"Python Image Steganography &#8211; Learn How To Hide Data in Images"},"content":{"rendered":"<p>Image Steganography is a python project in which we hide the secret message inside any image using Tkinter and the PIL module. Let&#8217;s start the development.<\/p>\n<h3>What is Image Steganography?<\/h3>\n<p>Steganography is the process of hiding a secret message which is text-based data within non-text files like image file, audio, video file etc. In such a way someone cannot know the presence of a hidden message in a particular file. The main purpose of Steganography is to maintain secret communication between two people. It generally refers to encoding and decoding. So in this image Steganography project, we will encode and decode the data into an image file.<\/p>\n<h3>Python Image Steganography &#8211; Project Details<\/h3>\n<p>Image steganography is a GUI-based project in which we are hiding a secret message within the image using encoding and decoding functions. We are creating a window in which there are two buttons: encoding and decoding.<\/p>\n<p>For encoding, select any image, this image will be converted into png format. Type message in the message box then it will convert into base64, merge this encoded string into image and the user can save the image where he\/she wants.<\/p>\n<p>For decoding, select the image which is encoded, the base64 string will get separated by decoding, and by Tkinter module hidden text is shown in the textbox.<\/p>\n<h3>Project Prerequisite<\/h3>\n<p>This project requires good knowledge of python and the Tkinter library. Tkinter is the python binding to the Tk toolkit which is used across many programming languages for building the Graphical user interface which is a GUI.<\/p>\n<p>Also, we require a PIL module. This is the images module from the pillow. The PIL module helps to open, manipulate and save many different forms of images.<\/p>\n<p>Use the following command to install PIL<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">python -m pip install pillow<\/pre>\n<h3>Download Image Steganography Project Code<\/h3>\n<p>Please download the source code of Python Image Steganography from the following link: <a href=\"https:\/\/drive.google.com\/file\/d\/1CavSDIQyN2InAS98MdQ1CJpwScSai7jG\/view?usp=drive_link\"><strong>Python Image Steganography Project<\/strong><\/a><\/p>\n<h3>Steps to Build a Python Image Steganography Project<\/h3>\n<p>Below are steps to implement Python Image Steganography Project:<\/p>\n<p>1. Import Modules.<br \/>\n2. Create a Function to make a main frame<br \/>\n3. Function to go back to the main frame<br \/>\n4. Function to Encoding and Decoding frame.<br \/>\n5. Create function for encoding image<br \/>\n6. Create function for decoding image<br \/>\n7. Function to decoding and generation of data<br \/>\n8. Function to modify the pixels of image<br \/>\n9. Function to enter the data pixels in image<br \/>\n10. Function to enter hidden text<br \/>\n11. GUI loop<\/p>\n<h4>Step 1- Importing Modules<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#DataFlair Python Image Stegangraphy project\r\nfrom tkinter import *\r\nimport tkinter.filedialog\r\nfrom tkinter import messagebox\r\nfrom PIL import ImageTk\r\nfrom PIL import Image\r\nfrom io import BytesIO\r\nimport os<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>Tkinter module &#8211; Tkinter is the standard interface in python for creating a GUI that is Graphical User Interface.<\/li>\n<li>tkinter import * &#8211; import everything from the module.<\/li>\n<li>tkinter.filedialog &#8211; This module is used to work with files.<\/li>\n<li>from tkinter import messagebox &#8211; Import message box separately for showing messages on the screen.<\/li>\n<li>PIL module &#8211; This is the images module from the pillow. The PIL module helps to open, manipulate and save many different forms of images.<\/li>\n<li>Import ImageTk &#8211; ImageTk module used to create and modify Tkinter photoimage from PIL images.<\/li>\n<li>io import Bytesio &#8211; Bytes data in the memory.<\/li>\n<li>Import os &#8211; This module is used for creating and removing any directory.<\/li>\n<\/ul>\n<h4>Step 2- Create a Function to make a Main frame<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#main frame or start page\r\n    def main(self, root):\r\n        root.title('ImageSteganography by DataFlair')\r\n        root.geometry('500x600')\r\n        root.resizable(width =False, height=False)\r\n        root.config(bg = '#e3f4f1')\r\n        frame = Frame(root)\r\n        frame.grid()\r\n       \r\n        title = Label(frame,text='DataFlair Image Steganography')\r\n        title.config(font=('Times new roman',25, 'bold'),bg = '#e3f4f1')\r\n        title.grid(pady=10)\r\n        title.grid(row=1)\r\n \r\n        encode = Button(frame,text=\"Encode\",command= lambda :self.encode_frame1(frame), padx=14,bg = '#e3f4f1' )\r\n        encode.config(font=('Helvetica',14), bg='#e8c1c7')\r\n        encode.grid(row=2)\r\n        decode = Button(frame, text=\"Decode\",command=lambda :self.decode_frame1(frame), padx=14,bg = '#e3f4f1')\r\n        decode.config(font=('Helvetica',14), bg='#e8c1c7')\r\n        decode.grid(pady = 12)\r\n        decode.grid(row=3)\r\n \r\n        root.grid_rowconfigure(1, weight=1)\r\n        root.grid_columnconfigure(0, weight=1)<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>main() &#8211; Function for making the main frame.<\/li>\n<li>root &#8211; Initializing the root window of Python Image Steganography Project.<\/li>\n<li>.title &#8211; Use to set title to window.<\/li>\n<li>.geometry &#8211; For setting dimensions of a window in pixels.<\/li>\n<li>.config &#8211; Used to configure attributes to the window, such as background color.<\/li>\n<li>.grid &#8211; for making grid frame on python image steganography project window<\/li>\n<li>title.grid &#8211; Used to make a grid and here we are giving padding as 10 pixels. For the first row which is row equals to 1.<\/li>\n<li>encode &#8211; encode variable creates the encode button using the command lambda: self and also gives padding as 14 and background color.<\/li>\n<li>decode &#8211; decode variable creates the decode button using the command lambda: self and also gives padding as 14 and background color.<\/li>\n<li>command lambda &#8211; It is used to pass data to the callback function.<\/li>\n<li>.grid_rowconfigure() &#8211; This method configures the row index of the grid and weight determines how large the row will occupy.<\/li>\n<li>.grid_columnconfigure() &#8211; This method configures the column index of the grid and weight determines how large the column will occupy.<\/li>\n<\/ul>\n<h4>Step 3- Function to go back to the main frame<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#Back function to loop back to main screen\r\n    def back(self,frame):\r\n        frame.destroy()\r\n        self.main(root)<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>back() &#8211; Function to get back on the main screen after encoding or decoding.<\/li>\n<li>.destroy() &#8211; Used when the process is completed by the user, then for destroying GUI components as well as clearing the screen.<\/li>\n<\/ul>\n<h4>Step 4- Function to Encoding and decoding frame<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#frame for encode page\r\n    def encode_frame1(self,F):\r\n        F.destroy()\r\n        F2 = Frame(root)\r\n        label1= Label(F2,text='Select the Image in which \\n you want to hide text :')\r\n        label1.config(font=('Times new roman',25, 'bold'),bg = '#e3f4f1')\r\n        label1.grid()\r\n \r\n        button_bws = Button(F2,text='Select',command=lambda : self.encode_frame2(F2))\r\n        button_bws.config(font=('Helvetica',18), bg='#e8c1c7')\r\n        button_bws.grid()\r\n        button_back = Button(F2, text='Cancel', command=lambda : IMG_Stegno.back(self,F2))\r\n        button_back.config(font=('Helvetica',18),bg='#e8c1c7')\r\n        button_back.grid(pady=15)\r\n        button_back.grid()\r\n        F2.grid()\r\n \r\n#frame for decode page\r\n    def decode_frame1(self,F):\r\n        F.destroy()\r\n        d_f2 = Frame(root)\r\n        lablel1 = Label(d_f2, text='Select Image with Hidden text:')\r\n        label1.config(font=('Times new roman',25,'bold'),bg = '#e3f4f1')\r\n        label1.grid()\r\n        label1.config(bg = '#e3f4f1')\r\n        button_bws = Button(d_f2, text='Select', command=lambda :self.decode_frame2(d_f2))\r\n        button_bws.config(font=('Helvetica',18), bg='#e8c1c7')\r\n        button_bws.grid()\r\n        button_back = Button(d_f2, text='Cancel', command=lambda : IMG_Stegno.back(self,d_f2))\r\n        button_back.config(font=('Helvetica',18), bg='#e8c1c7')\r\n        button_back.grid(pady=15)\r\n        button_back.grid()\r\n        d_f2.grid()<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>encode_frame1() &#8211; function for making encoded frame. Using parameters self and f. First, we destroy the f frame.<\/li>\n<li>f2- creating a new frame in an encoded frame.<\/li>\n<li>decode_frame1() &#8211; function for making an encoded frame. Using parameters self and f. First, we destroy the f frame.<\/li>\n<li>d_F2 &#8211; creating a new frame in the decode frame.<\/li>\n<li>label1 &#8211; In this variable, we use the label widget for displaying the box in which we give text. Then call configure to set font, font size, and background color.<\/li>\n<li>.grid() &#8211; make a grid of label1<\/li>\n<li>Here we are creating two buttons: select and cancel using variable button_bws and button_back using command lambda to callback the data.<\/li>\n<li>Then call configure to set font, font size, and background color in python image steganography project.<\/li>\n<\/ul>\n<h4>Step 5- Create function for encoding image<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># function to encode image\r\n    def encode_frame2(self,e_F2):\r\n        e_pg= Frame(root)\r\n        myfile = tkinter.filedialog.askopenfilename(filetypes = ([('png', '*.png'),('jpeg', '*.jpeg'),('jpg', '*.jpg'),('All Files', '*.*')]))\r\n        if not myfile:\r\n            messagebox.showerror(\"Error\",\"You have selected nothing !\")\r\n        else:\r\n            my_img = Image.open(myfile)\r\n            new_image = my_img.resize((300,200))\r\n            img = ImageTk.PhotoImage(new_image)\r\n            label3= Label(e_pg,text='Selected Image')\r\n            label3.config(font=('Helvetica',14,'bold'))\r\n            label3.grid() \r\n            board = Label(e_pg, image=img)\r\n            board.image = img\r\n            self.output_image_size = os.stat(myfile)\r\n            self.o_image_w, self.o_image_h = my_img.size\r\n            board.grid()\r\n            label2 = Label(e_pg, text='Enter the message')\r\n            label2.config(font=('Helvetica',14,'bold'))\r\n            label2.grid(pady=15)\r\n            text_a = Text(e_pg, width=50, height=10)\r\n            text_a.grid()\r\n            encode_button = Button(e_pg, text='Cancel', command=lambda : IMG_Stegno.back(self,e_pg))\r\n            encode_button.config(font=('Helvetica',14), bg='#e8c1c7')\r\n            data = text_a.get(\"1.0\", \"end-1c\")\r\n            button_back = Button(e_pg, text='Encode', command=lambda : [self.enc_fun(text_a,my_img),IMG_Stegno.back(self,e_pg)])\r\n            button_back.config(font=('Helvetica',14), bg='#e8c1c7')\r\n            button_back.grid(pady=15)\r\n            encode_button.grid()\r\n            e_pg.grid(row=1)\r\n            e_F2.destroy()<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>encode_frame2() &#8211; function for making a second encoding frame. Using parameters self and e_F2.<\/li>\n<li>.filedialog &#8211; this function is to create a directory and also helps to open save files in our directories.<\/li>\n<li>myfile &#8211; We create myfiles for opening the png, jpeg, jpg types of files from our directory using the tkinter tool filedialog.<\/li>\n<li>Here we have created an if-else loop. If you haven\u2019t selected anything from your directory. Then we pass a message box that shows an error that you have selected nothing.<\/li>\n<li>Else we will select a proper image from our directory.<\/li>\n<li>.open &#8211; This function is used to open files that are stored in our directory.<\/li>\n<li>.resize &#8211; this function returns a resize copy of the selected image that we have given 300&#215;200<\/li>\n<li>ImageTk.PhotoImage &#8211; For displaying images on the screen.<\/li>\n<li>label3 &#8211; In this variable, we use the label widget for displaying the box in which we give text. Then call configure to set font, font size, and background color.<\/li>\n<li>text_a &#8211; To create a text box in which we have to add our text, having width 50 and height 10.<\/li>\n<li>Board.image &#8211; displaying output image.<\/li>\n<li>os.stat &#8211; this method is used to call a specific path of the image. We are setting our image on the screen.<\/li>\n<li>label2 &#8211; label2 is created to enter the text. In this variable, we use the label widget for displaying the box in which we give text. Then call configure to set font, font size, and<\/li>\n<li>background color. And padding of 15 pixels.<\/li>\n<li>Here we are creating two encoding buttons: Encode and cancel using variable encode_button and button_back using command lambda to callback the data. Then call configure to set font, font size and background color.<\/li>\n<li>Apply the grid to the e_pg image variable and then destroy the e_F2 frame.<\/li>\n<\/ul>\n<h4>Step 6- Create function for decoding image<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># function to decode image\r\n    def decode_frame2(self,d_F2):\r\n        d_F3 = Frame(root)\r\n        myfiles = tkinter.filedialog.askopenfilename(filetypes = ([('png', '*.png'),('jpeg', '*.jpeg'),('jpg', '*.jpg'),('All Files', '*.*')]))\r\n        if not myfiles:\r\n            messagebox.showerror(\"Error\",\"You have selected nothing !\")\r\n        else:\r\n            my_img = Image.open(myfiles, 'r')\r\n            my_image = my_img.resize((300, 200))\r\n            img = ImageTk.PhotoImage(my_image)\r\n            label4= Label(d_F3,text='Selected Image :')\r\n            label4.config(font=('Helvetica',14,'bold'))\r\n            label4.grid()\r\n            board = Label(d_F3, image=img)\r\n            board.image = img\r\n            board.grid()\r\n            hidden_data = self.decode(my_img)\r\n            label2 = Label(d_F3, text='Hidden data is :')\r\n            label2.config(font=('Helvetica',14,'bold'))\r\n            label2.grid(pady=10)\r\n            text_a = Text(d_F3, width=50, height=10)\r\n            text_a.insert(INSERT, hidden_data)\r\n            text_a.configure(state='disabled')\r\n            text_a.grid()\r\n            button_back = Button(d_F3, text='Cancel', command= lambda :self.Page_3(d_F3))\r\n            button_back.config(font=('Helvetica',14),bg='#e8c1c7')\r\n            button_back.grid(pady=15)\r\n            button_back.grid()\r\n            d_F3.grid(row=1)\r\n            d_F2.destroy()<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>decode_frame2() &#8211; function for making a second decoding frame using parameters self and d_F2.<\/li>\n<li>Here we follow the same procedure that we did in encoding. step5.<\/li>\n<\/ul>\n<h4>Step 7- Function to decoding and generation of data<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#function to decode data\r\n    def decode(self, image):\r\n        image_data = iter(image.getdata())\r\n        data = ''\r\n \r\n        while (True):\r\n            pixels = [value for value in image_data.__next__()[:3] +\r\n                      image_data.__next__()[:3] +\r\n                      image_data.__next__()[:3]]\r\n            # string of binary data\r\n            binary_str = ''\r\n            for i in pixels[:8]:\r\n                if i % 2 == 0:\r\n                    binary_str += '0'\r\n                else:\r\n                    binary_str += '1'\r\n \r\n            data += chr(int(binary_str, 2))\r\n            if pixels[-1] % 2 != 0:\r\n                return data\r\n \r\n#function to generate data\r\n    def generate_Data(self,data):\r\n        # list of binary codes of given data\r\n        new_data = []\r\n \r\n        for i in data:\r\n            new_data.append(format(ord(i), '08b'))\r\n        return new_data<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>decode() &#8211; function to decode the image using the parameters self and image.<\/li>\n<li>iter &#8211; This iter function creates an object called image_data which iterates one element at a time.<\/li>\n<li>Data &#8211; containing the empty string of the data object.<\/li>\n<li>Here we are making a while loop for decoding the data. In the pixel variable, we are using a for loop for assigning a pixel to a specific image. Extracting 3 pixels at a time.<\/li>\n<li>Binary data string stored in the object then iterate by i.<\/li>\n<li>generate_data &#8211; for generating the data that we have passed.<\/li>\n<li>new_data &#8211; empty list of binary code of the given data.<\/li>\n<li>.append &#8211; use to add new data in the existing list.<\/li>\n<li>ord &#8211; this function returns the unicode from the given character.<\/li>\n<\/ul>\n<h4>Step 8- Function to modify the pixels of image<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#function to modify the pixels of image\r\n    def modify_Pix(self,pix, data):\r\n        dataList = self.generate_Data(data)\r\n        dataLen = len(dataList)\r\n        imgData = iter(pix)\r\n        for i in range(dataLen):\r\n            \r\n            pix = [value for value in imgData.__next__()[:3] +\r\n                   imgData.__next__()[:3] +\r\n                   imgData.__next__()[:3]]\r\n                        for j in range(0, 8):\r\n                if (dataList[i][j] == '0') and (pix[j] % 2 != 0):\r\n \r\n                    if (pix[j] % 2 != 0):\r\n                        pix[j] -= 1\r\n \r\n                elif (dataList[i][j] == '1') and (pix[j] % 2 == 0):\r\n                    pix[j] -= 1\r\n                       if (i == dataLen - 1):\r\n                if (pix[-1] % 2 == 0):\r\n                    pix[-1] -= 1\r\n            else:\r\n                if (pix[-1] % 2 != 0):\r\n                    pix[-1] -= 1\r\n \r\n            pix = tuple(pix)\r\n            yield pix[0:3]\r\n            yield pix[3:6]\r\n            yield pix[6:9]<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>modify_pix() &#8211; function for modifying pixels of images. Calling the data generation function in the datalist variable.<\/li>\n<li>len &#8211; Used to count the length of data.<\/li>\n<li>iter &#8211; This iter function creates an object which iterates one element at a time. Here we are iterating pixels.<\/li>\n<li>Here we are using the next for loop, in the pix object we are extracting three pixels at a time. And we are assigning pixel values 1 for odd and 0 for even.<\/li>\n<li>We give a range from 0 to 8. The eighth pixel of every set tells whether to stop and whether to read further and 0 means keep reading until the loop ends. And 1 denotes the message is over.<\/li>\n<li>yield &#8211; yield returns the function without destroying.<\/li>\n<\/ul>\n<h4>Step 9- Function to enter the data pixels in image<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#function to enter the data pixels in image\r\n    def encode_enc(self,newImg, data):\r\n        w = newImg.size[0]\r\n        (x, y) = (0, 0)\r\n \r\n        for pixel in self.modify_Pix(newImg.getdata(), data):\r\n \r\n            # Putting modified pixels in the new image\r\n            newImg.putpixel((x, y), pixel)\r\n            if (x == w - 1):\r\n                x = 0\r\n                y += 1\r\n            else:\r\n                x += 1<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>encode_enc &#8211; this is the function to enter the data pixels in an image.<\/li>\n<li>.size &#8211; Is used to count the number of pixels along with the image.<\/li>\n<li>We have created a for loop in which we have called the modify_pix function and getting data from the new image.<\/li>\n<li>put.pixel &#8211; putting modified pixels in the new image.<\/li>\n<\/ul>\n<h4>Step 10- Function to enter hidden text<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\"># function to enter hidden text\r\n    def enc_fun(self,text_a,myImg):\r\n        data = text_a.get(\"1.0\", \"end-1c\")\r\n        if (len(data) == 0):\r\n            messagebox.showinfo(\"Alert\",\"Kindly enter text in TextBox\")\r\n        else:\r\n            newImg = myImg.copy()\r\n            self.encode_enc(newImg, data)\r\n            my_file = BytesIO()\r\n            temp=os.path.splitext(os.path.basename(myImg.filename))[0]\r\n            newImg.save(tkinter.filedialog.asksaveasfilename (initialfile=temp, filetypes = ([('png', '*.png')]), defaultextension=\".png\"))\r\n            self.d_image_size = my_file.tell()\r\n            self.d_image_w,self.d_image_h = newImg.size\r\n            messagebox.showinfo(\"Success\",\"Encoding Successful\\nFile is saved as Image_with_hiddentext.png in the same directory\")\r\n \r\n    def frame_3(self,frame):\r\n        frame.destroy()\r\n        self.main(root)<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>enc_fun() &#8211; function for entering the hidden text in the text box.<\/li>\n<li>.get() &#8211; get function is used to return the value of an element with a specific key. And here we are fetching data from text_a.<\/li>\n<li>If the length of data entered is equal to zero then we pass a message box with a message to kindly enter text in the box.<\/li>\n<li>If not then we will go in else loop and copy myimg. And using the bytesio() method we manipulate bytes of data in memory.<\/li>\n<li>os.path.splitext() &#8211; This method is used to split the path of an image into the root and extension. Here we are giving filetype png and the extension is .png<\/li>\n<li>.save &#8211; used to save content of the python window in the python file or text file.<\/li>\n<li>tkinter.filedialog &#8211; This module is used to work with files.<\/li>\n<li>.tell() &#8211; it shows the location of the handle file and also returns the position of the file object.<\/li>\n<li>After successfully adding text and encoding the image we pass a message box with message Encoding successful, the file is saved in your directory.<\/li>\n<li>frame_3() &#8211; this is the function of third page<\/li>\n<li>.destroy() &#8211; Used when the process is completed by the user, then for destroying GUI components as well as clearing the screen.<\/li>\n<\/ul>\n<h4>Step 11- GUI loop<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">#GUI loop\r\nroot = Tk()\r\no = IMG_Stegno()\r\no.main(root)\r\nroot.mainloop()<\/pre>\n<h4><span style=\"text-decoration: underline\">Code Explanation-<\/span><\/h4>\n<ul>\n<li>root &#8211; Initializing the root window.<\/li>\n<li>IMG_Stegno() &#8211; End call of the main class in which all functions are present.<\/li>\n<li>.mainloop() &#8211; calling mainloop.<\/li>\n<\/ul>\n<h3>Python Image Steganography Project Output<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-output.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-108264\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-output.webp\" alt=\"python image steganography output\" width=\"1920\" height=\"1030\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>We have successfully created a python Image Steganography project using the Graphical User Interface(GUI). We have learned about the Tkinter and PIL modules. By using this, you can communicate with your friend secretly.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:2502,&quot;href&quot;:&quot;https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1CavSDIQyN2InAS98MdQ1CJpwScSai7jG\\\/view?usp=drive_link&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20260601062815\\\/https:\\\/\\\/drive.google.com\\\/file\\\/d\\\/1CavSDIQyN2InAS98MdQ1CJpwScSai7jG\\\/view?usp=drive_link&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-06-02 06:26:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-05 13:40:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-11 00:13:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-22 18:41:27&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-22 18:41:27&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Image Steganography is a python project in which we hide the secret message inside any image using Tkinter and the PIL module. Let&#8217;s start the development. What is Image Steganography? Steganography is the process&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":108265,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[21629,26707,26556,26555,21082,22734,21095],"class_list":["post-107491","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-basic-python-project-ideas","tag-image-steganography","tag-image-steganography-project-gui","tag-python-image-steganography-project","tag-python-project","tag-python-project-for-beginners","tag-python-project-ideas"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Image Steganography - Learn How To Hide Data in Images - DataFlair<\/title>\n<meta name=\"description\" content=\"Create Python Image Steganography project using Tkinter module for GUI and PIL modules to open, manipulate &amp; save different forms of images.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Image Steganography - Learn How To Hide Data in Images - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Create Python Image Steganography project using Tkinter module for GUI and PIL modules to open, manipulate &amp; save different forms of images.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-16T03:30:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-01T06:26:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-project.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Image Steganography - Learn How To Hide Data in Images - DataFlair","description":"Create Python Image Steganography project using Tkinter module for GUI and PIL modules to open, manipulate & save different forms of images.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/","og_locale":"en_US","og_type":"article","og_title":"Python Image Steganography - Learn How To Hide Data in Images - DataFlair","og_description":"Create Python Image Steganography project using Tkinter module for GUI and PIL modules to open, manipulate & save different forms of images.","og_url":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2022-03-16T03:30:56+00:00","article_modified_time":"2026-06-01T06:26:25+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-project.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"Python Image Steganography &#8211; Learn How To Hide Data in Images","datePublished":"2022-03-16T03:30:56+00:00","dateModified":"2026-06-01T06:26:25+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/"},"wordCount":1922,"commentCount":13,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-project.webp","keywords":["basic python project ideas","image steganography","Image Steganography Project GUI","Python Image Steganography Project","Python project","python project for beginners","python project ideas"],"articleSection":["Python Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/","url":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/","name":"Python Image Steganography - Learn How To Hide Data in Images - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-project.webp","datePublished":"2022-03-16T03:30:56+00:00","dateModified":"2026-06-01T06:26:25+00:00","description":"Create Python Image Steganography project using Tkinter module for GUI and PIL modules to open, manipulate & save different forms of images.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-project.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2022\/02\/python-image-steganography-project.webp","width":1200,"height":628,"caption":"python image steganography project"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/python-image-steganography-project\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Python Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Image Steganography &#8211; Learn How To Hide Data in Images"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":false,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/107491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=107491"}],"version-history":[{"count":9,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/107491\/revisions"}],"predecessor-version":[{"id":148571,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/107491\/revisions\/148571"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/108265"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=107491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=107491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=107491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}