A custom extension that:
- Preprocesses the image before extraction for a higher rate of accuracy.
- Converts math images to LaTeX.
- Renders LaTeX into styled PNG images and PDF format as well.
- Adds custom scripts for rendering, automation,and formatting.
Convert math question images into usable, editable LaTeX code and render the result into an image for reuse in:
- Educational content
- Scientific papers
- Digital documentation
- Exam generation
- Any math image file ('.png', '.jpg', etc.)
- Provided as a command-line argument or in code
The following diagram outlines the full process from raw math image to rendered LaTeX output.

This example demonstrates how a math image is converted into LaTeX and then rendered back as a polished output image.
This is the raw image of a math question passed into the tool.
Example:
The LaTeX code extracted using the 'pix2tex' model is printed below:
\frac{11 + x}{x^3}Alternatively the following LaTeX can also be the input for the latex_to_image.py file if the '\f' in '\frac' is assumed as an escape sequence by the Python interpreter:
\[\frac{11+x}{x^{3}}\]All custom code ('extract.py', 'render_latex.py') lives inside the 'LaTeX-OCR/' folder for import compatibility.
LaTeXConverter/
├── LaTeX-OCR/
│ ├── extract.py
│ ├── render_latex.py
│ └── ...
├── assets/
│ ├── mathdoubt.png
│ ├── rendered_latex.png
├── README.md
├── LICENSE
├── requirements.txtpython LaTeX-OCR/extract.py --input assets/mathdoubt.pngCode Modified From: Lukas Blecher