LaTeX to Image
收藏资源简介:
Convert LaTeX math formulas to high-quality PNG/SVG images instantly. Supports complex equations, matrices, integrals, and all LaTeX math symbols. Perfect for developers building education apps, math blogs, academic websites, Discord/Telegram bots, or any platform that needs to render mathematical formulas programmatically without installing LaTeX engines. Features: - All LaTeX math commands (fractions, integrals, matrices, Greek letters, etc.) - 5 color themes (default, dark...
LaTeX to Image API 数据集概述
该API用于将LaTeX数学公式字符串渲染为高质量的PNG图片,并返回图片的CDN URL、尺寸及文件大小。无需安装LaTeX引擎。
核心功能
- 输入:URL编码的LaTeX数学公式字符串。
- 输出:一个JSON对象,包含渲染后PNG图片的CDN URL、宽度(像素)、高度(像素)、文件大小(字节)和格式(固定为
png)。 - 支持格式:PNG(通过健康检查端点确认支持PNG,业务端点固定输出PNG)。
- 支持主题:5种文本颜色主题,分别为
default(黑色)、dark(白色)、blue(蓝色)、green(绿色)、warm(橙色)。 - 支持背景:
transparent(透明)、white(白色)、black(黑色)。 - 可调节参数:字号(16-128像素)、输出分辨率倍数(1-4)。
- 性能:响应时间小于500毫秒,99.9%正常运行时间。
支持的LaTeX命令
| 类别 | 命令 |
|---|---|
| 分数 | frac, dfrac, frac |
| 根号 | sqrt, sqrt[n] |
| 上标/下标 | ^, _ |
| 希腊字母 | alpha, eta, gamma, delta, pi, sigma, heta, lambda, mu, phi, omega(及大写变体) |
| 运算符 | sum, prod, int, iint, oint, lim |
| 关系符号 | pm, mp, imes, div, cdot, leq, geq, ` |
eq, approx, equiv, propto, infty` |
|
| 箭头 | ` |
ightarrow, leftarrow, Rightarrow, Leftrightarrow, mapsto` |
|
| 括号 | left(, ` |
ight), left[, |
|
ight], left{, |
|
| ight}` | |
| 矩阵 | egin{pmatrix}, egin{bmatrix}, egin{vmatrix}, egin{matrix} |
| 重音 | hat, ar, vec, dot, ddot, ilde |
| 字体与装饰 | mathbb, mathbf, mathcal, mathit, mathsf, mathtt, ext, overline, underline, color |
| 函数 | sin, cos, an, log, ln, exp, min, max, gcd, det, lim |
API端点
1. 渲染公式
- 方法:
GET - 路径:
/formula - 基础URL:
https://jianfei.aiboxuan.cn/api/v1/render - 请求参数:
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
latex |
string | 是 | — | LaTeX数学公式(需URL编码) |
theme |
string | 否 | default |
文本颜色主题 |
background |
string | 否 | transparent |
图片背景 |
fontSize |
integer | 否 | 48 |
字体大小(像素,范围16-128) |
scale |
integer | 否 | 2 |
输出分辨率倍数(范围1-4) |
- 响应(成功200):
json { "code": 200, "message": "success", "data": { "url": "https://file.aiboxuan.cn/render_1782311526100_4003.png", "width": 270, "height": 230, "sizeBytes": 3058, "format": "png" } }
- 响应(错误400):
json { "code": 400, "message": "latex parameter is required" }
- 响应(错误500):
json { "code": 500, "message": "LaTeX syntax error: Missing delimiter" }
2. 健康检查
- 方法:
GET - 路径:
/health - 响应:
json { "code": 200, "message": "success", "data": { "version": "1.0.0", "status": "ok", "supportedFormats": ["png"], "themes": ["default", "dark", "blue", "green", "warm"] } }
定价与限速
| 计划 | 请求数/月 | 价格 |
|---|---|---|
| Free | 100 | $0 |
| Basic | 5,000 | $4.99 |
| Pro | 50,000 | $19.99 |
| Ultra | 500,000 | $99.99 |



