https://github.com/guofei9987/text_blind_watermark
文本盲水印:把信息隐匿到文本中,put invisible blind watermark into a text.
https://github.com/guofei9987/text_blind_watermark
Last synced: 4 days ago
JSON representation
文本盲水印:把信息隐匿到文本中,put invisible blind watermark into a text.
- Host: GitHub
- URL: https://github.com/guofei9987/text_blind_watermark
- Owner: guofei9987
- License: mit
- Created: 2021-12-13T08:43:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-27T13:04:41.000Z (19 days ago)
- Last Synced: 2025-04-03T14:45:11.235Z (12 days ago)
- Language: Python
- Homepage: https://www.guofei.site/os/text_wm.html
- Size: 40 KB
- Stars: 1,501
- Watchers: 11
- Forks: 143
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome - guofei9987/text_blind_watermark - 文本盲水印:把信息隐匿到文本中,put invisible blind watermark into a text. (Python)
README
# text_blind_watermark
Embed an invisible message (blind watermark) into text, without altering its readability or appearance.
[](https://pypi.org/project/text_blind_watermark/)
[](https://app.travis-ci.com/guofei9987/text_blind_watermark)
[](https://codecov.io/gh/guofei9987/text_blind_watermark)
[](https://github.com/guofei9987/text_blind_watermark/blob/master/LICENSE)


[](https://github.com/guofei9987/text_blind_watermark/)
[](https://github.com/guofei9987/text_blind_watermark/fork)
[](https://pepy.tech/project/text_blind_watermark)- **Try it online**:[https://www.guofei.site/os/text_wm.html](https://www.guofei.site/os/text_wm.html)
- Video demo:[https://www.bilibili.com/video/BV1m3411s7kT](https://www.bilibili.com/video/BV1m3411s7kT)
- **Rust Version:** [https://github.com/guofei9987/hidden_watermark](https://github.com/guofei9987/hidden_watermark)
- **中文 readme** [README_cn.md](README_cn.md)
- **Source code:** [https://github.com/guofei9987/text_blind_watermark](https://github.com/guofei9987/text_blind_watermark)## ✨ Features
- Invisible watermark embedding in plain text
- No visible difference in appearance
- Verified in platforms: macOS, Windows, Linux, WeChat, DingTalk, Zhihu, Chrome, etc## 📦 Installation
```bash
pip install text_blind_watermark
```---
## 🛠 Usage
### Embed a watermark into text
```python
from text_blind_watermark import TextBlindWatermarkpassword = b"p@ssw0rd"
watermark = b"This is watermark"
original_text_file = 'files/file_txt.txt'
file_with_watermark = 'files/file_txt_with_watermark.txt'with open(original_text_file, 'r') as f:
text = f.read()twm = TextBlindWatermark(pwd=password)
# embed watermark into the text
text_with_wm = twm.add_wm_rnd(text=text, wm=watermark)# write into a new file
with open(file_with_watermark, 'w') as f:
f.write(text_with_wm)
```### Extract the watermark
```python
from text_blind_watermark import TextBlindWatermarkpassword = b"p@ssw0rd"
file_with_watermark = 'files/file_txt_with_watermark.txt'with open(file_with_watermark, 'r') as f:
text_with_wm_new = f.read()twm = TextBlindWatermark(pwd=password)
watermark_extract = twm.extract(text_with_wm_new)
print(watermark_extract)
```> Output: `This is watermark`
## 🔗 Related Project: [HideInfo](https://github.com/guofei9987/HideInfo)
| 算法 | 说明 |
|------|---------------------------------------------------|
| [migrate tank](https://github.com/guofei9987/HideInfo/blob/main/example/example_mirage_tank.py) | Show different images under different backgrounds |
| [hide as image](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_img.py) | Store data as an image |
| [hide in image](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_img.py) | Hide data inside an image |
| [image seed](https://github.com/guofei9987/HideInfo/blob/main/example/example_img_seed.py) | Merge image and file together |
| [EXIF](https://github.com/guofei9987/HideInfo/blob/main/example/example_img_exif.py) | Embed data in image EXIF metadata |
| [hide as music](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_music.py) | Store data as audio |
| [hide in music](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_music.py) | Hide data inside audio |
| [hide as text](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_txt.py) | Store data as plain text |
| [hide in text](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_txt.py) | Hide data within readable text |