Skip to main content

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

给作者来杯咖啡

开源不易,如果此项目对您有帮助,可以考虑 给作者加点油🥤,鼓鼓气💪🏻


官方代码库:https://github.com/breezedeus/antiocr

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

antiocr-0.1.tar.gz (283.5 kB view details)

Uploaded Source

Built Distribution

antiocr-0.1-py3-none-any.whl (563.7 kB view details)

Uploaded Python 3

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

Hashes for antiocr-0.1.tar.gz
Algorithm Hash digest
SHA256 e7215f501557367b7493fd91a5736a2fad1d4086563f525465c47bf4c78f6faa
MD5 69bb8b7043b3d7641fcd94d3080394ca
BLAKE2b-256 165fdb047436b52e5a80fdba670575acc7a0ec83f92655224c5454b6e0cc1156

See more details on using hashes here.

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

Hashes for antiocr-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab66e849554215bddc39a63ff180c5ea0e6ab34c949503eedd24c54cf5ae2264
MD5 353fc64b6d35f838d8a7766a3e48a7e7
BLAKE2b-256 5ce6d4871a9732366fd2bfadba024641eef60aa1743fb53b6a758676faaf1109

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page