Skip to content

Fix odd-length hex text extraction - #179

Open
cnYui wants to merge 1 commit into
guofei9987:masterfrom
cnYui:codex/fix-odd-hex-text-extract
Open

Fix odd-length hex text extraction#179
cnYui wants to merge 1 commit into
guofei9987:masterfrom
cnYui:codex/fix-odd-hex-text-extract

Conversation

@cnYui

@cnYui cnYui commented Jun 18, 2026

Copy link
Copy Markdown

Fixes #176.

Summary

  • Pad odd-length hex strings before bytes.fromhex() in string watermark extraction.
  • Keep the existing errors="replace" decode behavior, so attacked/cropped images may still decode to replacement text instead of claiming recovery.
  • Add a unittest regression case for the odd-length hex path and run it in GitHub Actions.

Tests

  • python -m unittest discover -s tests
  • python setup.py install
  • python examples/example_bit.py
  • python examples/example_img.py
  • python examples/example_no_writing.py
  • python examples/example_str.py
  • python examples/example_str_multi.py
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

提取水印时 bytes.fromhex() 报错 ValueError:Hex 字符串长度为奇数 (由图片裁剪/平移导致)

1 participant