mirror of
https://github.com/diptamath/Invisible-Image-watermarking.git
synced 2026-05-25 19:45:12 +02:00
automatic invisible watermarking of images
automatic invisible watermarking of images using qrcode to embed the information
This commit is contained in:
parent
4c3e3a17ba
commit
a3288051d7
6 changed files with 57 additions and 0 deletions
26
retrive watermark.py
Normal file
26
retrive watermark.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
from PIL import Image
|
||||
|
||||
from sys import argv
|
||||
from qrcode import make as makeQR
|
||||
|
||||
if __name__ == '__main__':
|
||||
im = Image.open("hello_watermark.png")
|
||||
s = w, h = im.size
|
||||
imd = im.load()
|
||||
|
||||
oim = Image.new('1', s)
|
||||
oimd = oim.load()
|
||||
|
||||
for i in range(w):
|
||||
for j in range(h):
|
||||
d = imd[i, j]
|
||||
oimd[i, j] = 255 * (d[-1] & 1)
|
||||
# oimd[i,j] = 255 * (d[-1]>>1 & 1)
|
||||
# oimd[i,j] = 255 * (1 if d[-1] & 0b111 == 0b111 else 0)
|
||||
|
||||
from os.path import splitext
|
||||
|
||||
root, ext = splitext("hello_watermark.png")
|
||||
fname = root + '_1bit' + ext
|
||||
oim.save(fname)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue