You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
667 B
15 lines
667 B
# cd D:\py310\Scripts
|
|
# pip install stegano -i https://pypi.tuna.tsinghua.edu.cn/simple/
|
|
# 安装stegano的步骤
|
|
from stegano import lsb # pip install stegano
|
|
|
|
message = "绘鸭AI相机" # 要写入的文本
|
|
origin_file = "d:/9fc0cb1d-12ec-4ed8-8199-b7ccd88da535.png" # 原图
|
|
new_name = "d:/10.png" # 要保存的新图片名称
|
|
encoding = "UTF-32LE" # 文本包含中文的话,需指定为该编码
|
|
secret = lsb.hide(origin_file, message, encoding=encoding) # 往图片写入文本
|
|
secret.save(new_name) # 保持到本地
|
|
|
|
unpack_msg: str = lsb.reveal(new_name, encoding=encoding) # 从本地图片里读出文本
|
|
print(f"{unpack_msg = }")
|