This tool is used to convert LaTeX formulas into corresponding images with the help of LaTeX tools.
Ubuntu:
sudo apt-get install texlive-full
# verify whether the installation is successful.
$ xelatex --help
# Usage: pdftex [OPTION]... [TEXNAME[.tex]] [COMMANDS]
# or: pdftex [OPTION]... \FIRST-LINE
# or: pdftex [OPTION]... &FMT ARGS
# Run pdfTeX on TEXNAME, usually creating TEXNAME.pdf.
MacOS
Recommend to install MacTex
# verify whether the installation is successful.
$ xelatex --help
# Usage: xetex [OPTION]... [TEXNAME[.tex]] [COMMANDS]
# or: xetex [OPTION]... \FIRST-LINE
# or: xetex [OPTION]... &FMT ARGS
# Run XeTeX on TEXNAME, usually creating TEXNAME.pdf.
pip install latex_to_image
$ latex_to_image "x^2+y^2=1" res.png
import cv2
from latex_to_image import LaTeXToImg
render = LaTeXToImg()
formula = "x^2 + y ^2 = 1"
img = render(formula)
cv2.imwrite("res.png", img)