Pix2Text MacOS App: A Mac Desktop App for Mathematical Formula Recognition and Text Recognition. Mac 本地数学公式识别和文本识别工具
MIT License
👩🏻💻 Pix2Text Online Service | 👨🏻💻 Pix2Text Online Demo | 📖 Online Doc | 💬 Contact
中文 | English
This project is a Mac local OCR application based on Pix2Text (no internet connection required). It can recognize mathematical formula images from the clipboard and convert them to their LaTeX representation, which can then be copied to the clipboard. Additionally, it supports text recognition (Text OCR) from general images.
Note ⚠️: This application is only available for MacOS.
The initial code of this project was forked from: horennel/LaTex-OCR_for_macOS. Special thanks to the author of this project.
After opening the application, you can see the Pix2Text application icon in the Mac menu bar, as shown below. It includes OCR for 4 different modes.
Text_Formula OCR
: Recognizing images with both formulas and textThis mode can recognize images containing both mathematical formulas and text. The recognition result is in Markdown format, which can be pasted into the Pix2Text Online Service to view the rendered result.
For example, it can recognize the following image (assets/mixed-en.jpg):
Formula OCR
: Recognizing images with pure formulasThis mode can recognize images containing only mathematical formulas. The recognition result is in LaTeX format, which can be pasted into the Pix2Text Online Service to view the rendered result.
For example, it can recognize the following image (assets/math-formula-42.png):
Text OCR
: Recognizing images with pure textThis mode can recognize images containing only text. The recognition result is in plain text.
For example, it can recognize the following image (assets/text.jpg):
Page OCR
: Recognizing Page Screenshots with Complex LayoutsIf an image contains complex layout structures, such as multi-column layouts or includes tables and other information, you can use this mode for recognition. This mode will additionally load the Layout Analysis and Table Recognition models from pix2text~=1.1
to recognize all information in the image and integrate the recognition results into Markdown format. You can paste the results into the Pix2Text web version to view the rendered results.
The recognition results will also be saved to a specified local folder. The folder location can be specified by the output_md_root_dir
variable in the configuration file config.yaml, which defaults to the /tmp/output_mds
folder. Additionally, the parsing results will be saved to a specified local folder. The folder location can be specified by the output_debug_dir
variable in the configuration file config.yaml, which defaults to the /tmp/output_debugs
folder. You can manually change the values of these two variables to specify the storage location.
For example, it can recognize the following image (assets/page.png):
git clone https://github.com/breezedeus/Pix2Text-Mac
pip install -r requirements.txt
If you want to recognize text images in languages other than Simplified Chinese and English, please run the following command to install additional dependencies:
pip install pix2text[multilingual]>=1.1.0.1
Use the following command to verify if the installed Pix2Text is working normally:
p2t predict -l en,ch_sim --resized-shape 768 --file-type page -i assets/page.png -o output-page --save-debug-res output-debug-page
python setup.py py2app -A
Pix2Text.app
in the generated dist
folder. Double-click to open it, or move it to the Applications
folder.Pix2Text.app
application, and you will see the Pix2Text application icon in the menu bar.On / Off
button in the menu bar icon to ensure that the Mixed OCR
, Formula OCR
, and Mixed OCR
buttons are lit up.Snipaste
, to capture and copy to the clipboard.Text_Formula OCR
button.Formula OCR
button.Text OCR
button.Page OCR
button.~/.cnstd
, ~/.cnocr
, and ~/.pix2text
.