# text_blind_watermark
Put message(blind watermark) into a text. so that the message is invisible, and the changes of the text are not perceptible.
[](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)
- Video demo:[https://www.bilibili.com/video/BV1m3411s7kT](https://www.bilibili.com/video/BV1m3411s7kT)
- Online demo(from old version, for demo only): [https://www.guofei.site/pictures_for_blog/app/text_watermark/v1.html](https://www.guofei.site/pictures_for_blog/app/text_watermark/v1.html)
- **中文 readme** [README_cn.md](README_cn.md)
- **Source code:** [https://github.com/guofei9987/text_blind_watermark](https://github.com/guofei9987/text_blind_watermark)
- **Rust Version:** [https://github.com/guofei9987/hidden_watermark](https://github.com/guofei9987/hidden_watermark)
Can be used in
- [x] Wechat
- [x] dingding
- [x] zhihu.com
- [x] ...
## How to Use
install
```bash
pip install text_blind_watermark
```
### embed message into text:
```python
from text_blind_watermark import TextBlindWatermark
password = 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)
# add 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)
```
### read and extract watermark
```python
from text_blind_watermark import TextBlindWatermark
password = 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)
```
>watermark extracted: This is a watermark
## Related Project
HideInfo:[https://github.com/guofei9987/HideInfo](https://github.com/guofei9987/HideInfo)
| 算法 | 说明 |
|------|-------------------|
| [migrate tank](https://github.com/guofei9987/HideInfo/blob/main/example/example_mirage_tank.py) | 使图片在不同的背景下显示不同的图片 |
| [hide as image](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_img.py) | 把数据以图片形式存放 |
| [hide in image](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_img.py) | 把数据藏在一个图片中 |
| [image seed](https://github.com/guofei9987/HideInfo/blob/main/example/example_img_seed.py) | 把图片和文件黏在一起,并存为图片 |
| [EXIF](https://github.com/guofei9987/HideInfo/blob/main/example/example_img_exif.py) | 把一段信息放到图片的EXIF中 |
| [hide as music](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_music.py) | 把数据以音频的形式存放 |
| [hide in music](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_music.py) | 把数据隐藏在一个音频中 |
| [hide as text](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_txt.py) | 把数据以文本文件的形式存放 |
| [hide in text](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_txt.py) | 把数据隐藏在一段文本中 |
Raw data
{
"_id": null,
"home_page": "https://github.com/guofei9987/text_blind_watermark",
"name": "text-blind-watermark",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": null,
"keywords": null,
"author": "Guo Fei",
"author_email": "guofei9987@foxmail.com",
"download_url": "https://files.pythonhosted.org/packages/45/e1/5a428f9cd0aa04cd5802ace995be4c267e93a3686ebf2ec40023662a13d3/text_blind_watermark-0.4.2.tar.gz",
"platform": "linux",
"description": "# text_blind_watermark\n\nPut message(blind watermark) into a text. so that the message is invisible, and the changes of the text are not perceptible.\n\n[](https://pypi.org/project/text_blind_watermark/)\n[](https://app.travis-ci.com/guofei9987/text_blind_watermark)\n[](https://codecov.io/gh/guofei9987/text_blind_watermark)\n[](https://github.com/guofei9987/text_blind_watermark/blob/master/LICENSE)\n\n\n[](https://github.com/guofei9987/text_blind_watermark/)\n[](https://github.com/guofei9987/text_blind_watermark/fork)\n[](https://pepy.tech/project/text_blind_watermark)\n\n\n- Video demo\uff1a[https://www.bilibili.com/video/BV1m3411s7kT](https://www.bilibili.com/video/BV1m3411s7kT)\n- Online demo(from old version, for demo only): [https://www.guofei.site/pictures_for_blog/app/text_watermark/v1.html](https://www.guofei.site/pictures_for_blog/app/text_watermark/v1.html)\n- **\u4e2d\u6587 readme** [README_cn.md](README_cn.md)\n- **Source code:** [https://github.com/guofei9987/text_blind_watermark](https://github.com/guofei9987/text_blind_watermark)\n- **Rust Version:** [https://github.com/guofei9987/hidden_watermark](https://github.com/guofei9987/hidden_watermark)\n\n\nCan be used in \n- [x] Wechat\n- [x] dingding\n- [x] zhihu.com \n- [x] ...\n\n## How to Use\n\ninstall\n\n```bash\npip install text_blind_watermark\n```\n\n### embed message into text:\n\n```python\nfrom text_blind_watermark import TextBlindWatermark\n\npassword = b\"p@ssw0rd\"\nwatermark = b\"This is watermark\"\noriginal_text_file = 'files/file_txt.txt'\nfile_with_watermark = 'files/file_txt_with_watermark.txt'\n\nwith open(original_text_file, 'r') as f:\n text = f.read()\n\ntwm = TextBlindWatermark(pwd=password)\n\n# add watermark into the text\ntext_with_wm = twm.add_wm_rnd(text=text, wm=watermark)\n\n# write into a new file\nwith open(file_with_watermark, 'w') as f:\n f.write(text_with_wm)\n```\n\n\n### read and extract watermark\n\n```python\nfrom text_blind_watermark import TextBlindWatermark\n\npassword = b\"p@ssw0rd\"\nfile_with_watermark = 'files/file_txt_with_watermark.txt'\n\nwith open(file_with_watermark, 'r') as f:\n text_with_wm_new = f.read()\n\ntwm = TextBlindWatermark(pwd=password)\nwatermark_extract = twm.extract(text_with_wm_new)\nprint(watermark_extract)\n```\n\n>watermark extracted\uff1a This is a watermark\n\n\n## Related Project\n\nHideInfo\uff1a[https://github.com/guofei9987/HideInfo](https://github.com/guofei9987/HideInfo)\n\n\n| \u7b97\u6cd5 | \u8bf4\u660e |\n|------|-------------------|\n| [migrate tank](https://github.com/guofei9987/HideInfo/blob/main/example/example_mirage_tank.py) | \u4f7f\u56fe\u7247\u5728\u4e0d\u540c\u7684\u80cc\u666f\u4e0b\u663e\u793a\u4e0d\u540c\u7684\u56fe\u7247 |\n| [hide as image](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_img.py) | \u628a\u6570\u636e\u4ee5\u56fe\u7247\u5f62\u5f0f\u5b58\u653e |\n| [hide in image](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_img.py) | \u628a\u6570\u636e\u85cf\u5728\u4e00\u4e2a\u56fe\u7247\u4e2d |\n| [image seed](https://github.com/guofei9987/HideInfo/blob/main/example/example_img_seed.py) | \u628a\u56fe\u7247\u548c\u6587\u4ef6\u9ecf\u5728\u4e00\u8d77\uff0c\u5e76\u5b58\u4e3a\u56fe\u7247 |\n| [EXIF](https://github.com/guofei9987/HideInfo/blob/main/example/example_img_exif.py) | \u628a\u4e00\u6bb5\u4fe1\u606f\u653e\u5230\u56fe\u7247\u7684EXIF\u4e2d |\n| [hide as music](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_music.py) | \u628a\u6570\u636e\u4ee5\u97f3\u9891\u7684\u5f62\u5f0f\u5b58\u653e |\n| [hide in music](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_music.py) | \u628a\u6570\u636e\u9690\u85cf\u5728\u4e00\u4e2a\u97f3\u9891\u4e2d |\n| [hide as text](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_as_txt.py) | \u628a\u6570\u636e\u4ee5\u6587\u672c\u6587\u4ef6\u7684\u5f62\u5f0f\u5b58\u653e |\n| [hide in text](https://github.com/guofei9987/HideInfo/blob/main/example/example_hide_in_txt.py) | \u628a\u6570\u636e\u9690\u85cf\u5728\u4e00\u6bb5\u6587\u672c\u4e2d |\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Text Blind Watermark in Python",
"version": "0.4.2",
"project_urls": {
"Homepage": "https://github.com/guofei9987/text_blind_watermark"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "eed3ca3da3cc0b0c0ca749aaec2a3366fb8df0e35cdfe2f3bb152a2e3ff5e483",
"md5": "9ce81520639fceb7e05059818635202a",
"sha256": "72ac14ae1caec102df06a5a36df3f9e4d706f6ffa4eebb9e1835e77cf619510b"
},
"downloads": -1,
"filename": "text_blind_watermark-0.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9ce81520639fceb7e05059818635202a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 6060,
"upload_time": "2024-11-20T11:46:02",
"upload_time_iso_8601": "2024-11-20T11:46:02.299464Z",
"url": "https://files.pythonhosted.org/packages/ee/d3/ca3da3cc0b0c0ca749aaec2a3366fb8df0e35cdfe2f3bb152a2e3ff5e483/text_blind_watermark-0.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "45e15a428f9cd0aa04cd5802ace995be4c267e93a3686ebf2ec40023662a13d3",
"md5": "fb6c600e9cf7024a04814d431cf72064",
"sha256": "558b3a63eb5fcaee110f8c18aa809e99937369479fbb63be26c3a885b3f10606"
},
"downloads": -1,
"filename": "text_blind_watermark-0.4.2.tar.gz",
"has_sig": false,
"md5_digest": "fb6c600e9cf7024a04814d431cf72064",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 5517,
"upload_time": "2024-11-20T11:46:04",
"upload_time_iso_8601": "2024-11-20T11:46:04.339175Z",
"url": "https://files.pythonhosted.org/packages/45/e1/5a428f9cd0aa04cd5802ace995be4c267e93a3686ebf2ec40023662a13d3/text_blind_watermark-0.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 11:46:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "guofei9987",
"github_project": "text_blind_watermark",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "setuptools",
"specs": []
},
{
"name": "crypt_tool",
"specs": [
[
">=",
"0.1.3"
]
]
}
],
"lcname": "text-blind-watermark"
}