textblindwatermark

September 6, 2025 · View on GitHub

Embed an invisible message (blind watermark) into text, without altering its readability or appearance.

PyPI Build Status codecov License Python Platform stars fork Downloads Featured|HelloGitHub

✨ Features

  • Invisible watermark embedding in plain text
  • No visible difference in appearance
  • Verified in platforms: macOS, Windows, Linux, WeChat, DingTalk, Zhihu, Chrome, etc

📦 Installation

pip install text_blind_watermark

🛠 Usage

Embed a watermark into text

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)

# 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

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)

Output: This is watermark

算法说明
migrate tankShow different images under different backgrounds
hide as imageStore data as an image
hide in imageHide data inside an image
image seedMerge image and file together
EXIFEmbed data in image EXIF metadata
hide as musicStore data as audio
hide in musicHide data inside audio
hide as textStore data as plain text
hide in textHide data within readable text