import qrcode
img = qrcode.make('Binoy Thomas')
print(type(img)) # <class 'qrcode.image.pil.PilImage'>
print(img.size) # (290, 290)
img.save('QR.png')
img = qrcode.make('Binoy Thomas')
print(type(img)) # <class 'qrcode.image.pil.PilImage'>
print(img.size) # (290, 290)
img.save('QR.png')
https://www.section.io/engineering-education/steganography-in-python/
# pip install opencv-python
from tkinter import *
from PIL import Image, ImageTk
from tkinter import filedialog
import cv2
import numpy as np
import math
global path_image
image_display_size = 300, 300
def OnClick():
global path_image
path_image = filedialog.askopenfilename()
load_image = Image.open(path_image)
load_image.thumbnail(image_display_size, Image.ANTIALIAS)
np_load_image = np.asarray(load_image)
np_load_image = Image.fromarray(np.uint8(np_load_image))
render = ImageTk.PhotoImage(np_load_image)
img = Label(app, image=render)
img.image = render
img.place(x=20, y=50)
def Encrypt():
global path_image
data = txt.get(1.0, "end-1c")
img = cv2.imread(path_image)
data = [format(ord(i), '08b') for i in data] # break image to binary chararacters
_, width, _ = img.shape
PixReq = len(data) * 3 # algorithm to encode the image
RowReq = PixReq/width
RowReq = math.ceil(RowReq)
count = 0
charCount = 0
for i in range(RowReq + 1):
while(count < width and charCount < len(data)):
char = data[charCount]
charCount += 1
for index_k, k in enumerate(char):
if((k == '1' and img[i][count][index_k % 3] % 2 == 0) or (k == '0' and img[i][count][index_k % 3] % 2 == 1)):
img[i][count][index_k % 3] -= 1
if(index_k % 3 == 2):
count += 1
if(index_k == 7):
if(charCount*3 < PixReq and img[i][count][2] % 2 == 1):
img[i][count][2] -= 1
if(charCount*3 >= PixReq and img[i][count][2] % 2 == 0):
img[i][count][2] -= 1
count += 1
count = 0
cv2.imwrite("EncryptedImage.png", img)
success_label = Label(app, text="Encrypted!", bg='lavender', font=("Helvetica", 20))
success_label.place(x=130, y=360)
app = Tk()
app.configure(background='lavender')
app.title("Encrypt")
app.geometry('400x400')
btnSelect = Button(app, text="Select PNG Image (Max 500 x 300)", command=OnClick)
btnSelect.place(x=100, y=10)
txt = Text(app, wrap=WORD, width=30)
txt.place(x=80, y=220, height=100)
encrypt_button = Button(app, text="Encode", bg='white', fg='black', command=Encrypt)
encrypt_button.place(x=180, y=328)
app.mainloop()
from tkinter import *
import time
import sys
root=Tk()
root.title("Digital Clock")
def get_time():
time_string=time.strftime("%I:%M:%S %p")
clock.config(text=time_string)
clock.after(170, get_time)
clock = Label(root, font=("time", 90, "bold"), bg="green")
clock.pack()
get_time()
root.mainloop()