Python3 package for generating text images which can't be recognized by AI
Project description
antiOCR
Anti OCR, Free Texts.
拒绝图片文字被OCR,让文字自由传播! antiOCR 把指定文本转换成机器无法识别但人可读的文字图片。
欢迎扫码加小助手为好友,备注 anti,小助手会定期统一邀请大家入群:
作者也维护 知识星球私享群 ,这里面的提问会较快得到作者的回复,欢迎加入。知识星球私享群也会陆续发布一些开源项目相关的私有资料,包括一些使用教程,未公开的模型,不同应用场景的调用代码,使用过程中遇到的难题解答等。本群也会发布一些相关的最新研究资料。
使用说明
调用很简单,以下是示例:
from antiocr import AntiOcr
texts = '拒绝图片文字被OCR,让文字自由传播! antiOCR 把指定文本转换成机器无法识别但人可读的文字图片。'
anti = AntiOcr()
# 生成文字图片
img = anti(
texts,
font_fp='/System/Library/Fonts/PingFang.ttc', # 使用的字体文件
)
img.save("output.png")
使用示例可以参考 Streamlit Demo 。
目前 antiOCR 使用的反OCR方法主要包括:
- 每个文字随机使用不同大小的字体;
- 每个汉字按指定概率进行倒转(随机生成倒转角度);
- 每个汉字按指定概率转换为中文拼音;
- 【可选】随机生成干扰的背景图片;
- 字体可按需指定;
示例
| 生成的图片 | 背景图片来源 |
|
|
固定图片 |
|
|
固定图片 |
|
|
固定图片 |
|
|
随机图片 |
|
|
随机图片 |
|
|
随机图片 |
安装
嗯,顺利的话一行命令即可。
pip install antiocr
安装速度慢的话,可以指定国内的安装源,如使用豆瓣源:
pip install antiocr -i https://pypi.doubanio.com/simple
给作者来杯咖啡
开源不易,如果此项目对您有帮助,可以考虑 给作者加点油🥤,鼓鼓气💪🏻 。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file antiocr-0.1.tar.gz.
File metadata
- Download URL: antiocr-0.1.tar.gz
- Upload date:
- Size: 283.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.1 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7215f501557367b7493fd91a5736a2fad1d4086563f525465c47bf4c78f6faa
|
|
| MD5 |
69bb8b7043b3d7641fcd94d3080394ca
|
|
| BLAKE2b-256 |
165fdb047436b52e5a80fdba670575acc7a0ec83f92655224c5454b6e0cc1156
|
File details
Details for the file antiocr-0.1-py3-none-any.whl.
File metadata
- Download URL: antiocr-0.1-py3-none-any.whl
- Upload date:
- Size: 563.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.1 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab66e849554215bddc39a63ff180c5ea0e6ab34c949503eedd24c54cf5ae2264
|
|
| MD5 |
353fc64b6d35f838d8a7766a3e48a7e7
|
|
| BLAKE2b-256 |
5ce6d4871a9732366fd2bfadba024641eef60aa1743fb53b6a758676faaf1109
|