Skip to content

About

Phantom-tank hidden-image generator: merge a cover image + a hidden image into one PNG

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Image Insert — 幻影坦克 / 隐藏图生成器

把两张图片(表面图 + 隐藏图)合成一张「嵌入图片」的小工具。 未点开(白底缩略图)显示表面图,点开大图(黑底)显示隐藏图——即常说的 QQ 隐藏图 / 幻影坦克(Phantom Tank)。

A tiny tool that merges a cover image and a hidden image into one "phantom" PNG: the thumbnail (composited on white) shows the cover, while the full image (composited on black) reveals the hidden one.

原理 / How it works

输出 PNG 的 RGB 通道存灰度颜色 C、alpha 通道存 A。The output PNG stores a grayscale color C in RGB and A in alpha:

A = 255 - 表面亮度 + 隐藏亮度
C = 隐藏亮度 × 255 / A
  • 白底合成 = C·A/255 + 255·(1-A/255) = 表面图亮度(cover luminance)
  • 黑底合成 = C·A/255 = 隐藏图亮度(hidden luminance)

隐藏图(点开后看到的那张)以灰度形式显现,这是 PNG 单透明通道的固有限制。

运行 / Run

需要 Python 3.10+:

pip install -r requirements.txt
python image_insert.py

打包为 exe / Build standalone exe

pip install pyinstaller
pyinstaller --noconfirm --onefile --windowed --name ImageInsert image_insert.py

产物在 dist/ImageInsert.exe。

使用 / Usage

  1. 选择「表面图(缩略图/封面)」和「隐藏图(点开后显示)」各一张。
  2. 点击「一键生成并保存」,或先「仅生成预览」查看白底/黑底两种效果。
  3. 把生成的 PNG 发到微信 / QQ 等聊天软件,缩略图是封面、点开是隐藏图。

建议表面图选偏亮的图(纯白、浅色、亮度较高),隐藏图越暗效果越干净。

测试 / Test

python test_phantom.py

校验白底合成 ≈ 表面图、黑底合成 ≈ 隐藏图,以及纯白封面特例。

License

MIT

About

Phantom-tank hidden-image generator: merge a cover image + a hidden image into one PNG

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages