LaTeX maths to image
Draw a LaTeX maths formula as a sharp SVG or PNG picture, with a choice of font, size and colours. Lays out a formula written in LaTeX maths notation and saves it as a picture that fits it exactly. It supports a fixed set of maths commands rather than a full TeX system, so nothing in a formula can read a file or run a program.
Input
Result
Choose a file and press Run.
Files you upload and the results are stored for one hour, then deleted. Anyone who has the link can open them, so don't upload anything private.
Use it from code or an agent
curl -s https://setget.net/v1/tools/math \
-H 'Content-Type: application/json' \
-d '{"input":{"latex":"x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}"},"wait":30}'
import json, urllib.request
body = {'input': {'latex': 'x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}'}, 'wait': 30}
request = urllib.request.Request("https://setget.net/v1/tools/math", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/math", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"latex":"x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}"},"wait":30}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "math",
"input": {
"latex": "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}"
},
"wait": 30
}
{
"input": {
"latex": "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}"
},
"wait": 30
}
This is a file tool, so a call takes three steps: upload the file to get a reference, run the tool with that reference, then read the result and download its files. Uploads and results are public by link and expire after one hour.
Endpoint: POST /v1/tools/math. Over MCP: run_tool with slug: "math".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
latex |
string | yes | The formula in LaTeX maths notation, with or without $ around it. |
format |
string | no | svg stays sharp at any size; png is a fixed-size picture. One of: svg, png. Default: "svg". |
font_size |
integer | no | Size of the letters in points. Default: 24. From 6 to 200. |
colour |
string | no | Colour of the formula: hex such as #1e3a8a, or a basic colour name. Default: "#000000". |
background |
string | no | Background colour: hex such as #ffffff, a basic colour name, or "transparent". Default: "transparent". |
font |
string | no | Typeface: cm is the classic LaTeX look, stix resembles Times, stixsans and dejavusans are sans-serif, dejavuserif is a wider serif. One of: cm, stix, stixsans, dejavusans, dejavuserif. Default: "cm". |
dpi |
integer | no | Resolution of a PNG, in dots per inch: 72 gives one pixel per point. Ignored for SVG. Default: 200. From 50 to 600. |
padding |
integer | no | Empty space around the formula, in points. Default: 6. From 0 to 100. |
Examples
The quadratic formula as SVG
{
"latex": "x = \\frac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}"
}Press the example button above to make it.
A dark blue PNG on white
{
"latex": "$e^{i\\pi} + 1 = 0$",
"format": "png",
"font": "stix",
"font_size": 32,
"colour": "#1e3a8a",
"background": "#ffffff",
"dpi": 150
}Press the example button above to make it.
A sum in a sans-serif font
{
"latex": "\\sum_{n=1}^{\\infty} \\frac{1}{n^2} = \\frac{\\pi^2}{6}",
"font": "dejavusans"
}Press the example button above to make it.
Questions
- Is this full LaTeX?
- No. It draws the maths that fits on one line: fractions, roots, powers and indices, sums, integrals, Greek letters, brackets that grow with \left and \right, accents, \text{} and the maths fonts. Environments such as matrix, align and cases, line breaks, colour commands and macros are not supported.
- Do I need to put $ around the formula?
- No. Surrounding $, $$, \[ \] or \( \) are removed if you include them. \displaystyle and \textstyle are left out as well; the result lists them when that happens.
- Will the SVG look the same everywhere?
- Yes. Every letter is stored as a shape, so no font needs to be installed where the picture is shown, and the file refers to nothing outside itself.
- Which characters can I use?
- Latin letters with accents, Greek, Cyrillic and the usual maths symbols. Chinese, Japanese, Korean and emoji cannot be drawn: the tool says which character is the problem.
- How large is the picture?
- It fits the formula plus the padding. For a PNG, raise the dpi for more pixels: the limit is 8,000 pixels per side.
Related tools
- Graphviz diagram rendererDraw a diagram from Graphviz DOT source as SVG or PNG: flowcharts, trees, networks and dependency graphs.
graphviz - Chart generatorMake a clean SVG bar, line, area, pie or donut chart from labels and values, with axes, legend and title.
chart - Code to imageTurn source code into a shareable picture with syntax highlighting, a window frame and a choice of themes.
code-image - SVG to PNGRender an SVG drawing to a PNG image at any size, with a transparent or solid background.
svg-to-png - Convert image formatConvert an image between PNG, JPG, WebP, AVIF, GIF, BMP, TIFF and ICO. Animated GIF and WebP stay animated.
image-convert - .gitignore generatorBuild a .gitignore for the languages, editors and operating systems you use, merged without duplicates.
gitignore-generate