
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Blind watermark based on dct and svd.
pip install blind-watermark
For the current developer version:
git clone git@github.com:guofei9987/blind_watermark.git
cd blind_watermark
pip install .
# embed watermark into image:
blind_watermark --embed --pwd 1234 examples/pic/ori_img.jpeg "watermark text" examples/output/embedded.png
# extract watermark from image:
blind_watermark --extract --pwd 1234 --wm_shape 111 examples/output/embedded.png
Original Image + Watermark = Watermarked Image
+ '@guofei9987 开源万岁!' =
See the codes
Embed watermark:
from blind_watermark import WaterMark
bwm1 = WaterMark(password_img=1, password_wm=1)
bwm1.read_img('pic/ori_img.jpg')
wm = '@guofei9987 开源万岁!'
bwm1.read_wm(wm, mode='str')
bwm1.embed('output/embedded.png')
len_wm = len(bwm1.wm_bit)
print('Put down the length of wm_bit {len_wm}'.format(len_wm=len_wm))
Extract watermark:
bwm1 = WaterMark(password_img=1, password_wm=1)
wm_extract = bwm1.extract('output/embedded.png', wm_shape=len_wm, mode='str')
print(wm_extract)
Output:
@guofei9987 开源万岁!
attack method | image after attack | extracted watermark |
---|---|---|
Rotate 45 Degrees | ![]() | '@guofei9987 开源万岁!' |
Random crop | ![]() | '@guofei9987 开源万岁!' |
Masks | ![]() | '@guofei9987 开源万岁!' |
50% Horizontal cut | ![]() | '@guofei9987 开源万岁!' |
50% Vertical cut | ![]() | '@guofei9987 开源万岁!' |
Resize 0.5 | ![]() | '@guofei9987 开源万岁!' |
Pepper Noise | ![]() | '@guofei9987 开源万岁!' |
Brightness 10% Down | ![]() | '@guofei9987 开源万岁!' |
embed watermark:
from blind_watermark import WaterMark
bwm1 = WaterMark(password_wm=1, password_img=1)
# read original image
bwm1.read_img('pic/ori_img.jpg')
# read watermark
bwm1.read_wm('pic/watermark.png')
# embed
bwm1.embed('output/embedded.png')
Extract watermark:
bwm1 = WaterMark(password_wm=1, password_img=1)
# notice that wm_shape is necessary
bwm1.extract(filename='output/embedded.png', wm_shape=(128, 128), out_wm_name='output/extracted.png', )
attack method | image after attack | extracted watermark |
---|---|---|
Rotate 45 Degrees | ![]() | ![]() |
Random crop | ![]() | ![]() |
Mask | ![]() | ![]() |
See it here
As demo, we embed 6 bytes data:
wm = [True, False, True, True, True, False]
Embed:
from blind_watermark import WaterMark
bwm1 = WaterMark(password_img=1, password_wm=1)
bwm1.read_ori_img('pic/ori_img.jpg')
bwm1.read_wm([True, False, True, True, True, False], mode='bit')
bwm1.embed('output/embedded.png')
Extract:
bwm1 = WaterMark(password_img=1, password_wm=1, wm_shape=6)
wm_extract = bwm1.extract('output/打上水印的图.png', mode='bit')
print(wm_extract)
Notice that wm_shape
(shape of watermark) is necessary
The output wm_extract
is an array of float. set a threshold such as 0.5.
WaterMark(..., processes=None)
processes
: number of processes, can be integer. Default None
, meaning use all processes.text_blind_watermark: https://github.com/guofei9987/text_blind_watermark
Embed message into text.
FAQs
Blind Watermark in Python
We found that blind-watermark demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.