A lightweight REST API that calculates missing screen properties (width, height, diagonal, aspect ratio, megapixels) when given at least two inputs.
https://www.promptbox.cn/api/aspect.php
GET
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
x |
float | No | 1920 | Screen width (pixels) |
y |
float | No | 1080 | Screen height (pixels) |
z |
float | No | 22.03 | Screen diagonal (same unit as width/height) |
ratio |
string | No | 16:9 | Aspect ratio (colon-separated, e.g. 16:9) |
Note: You must provide at least 2 parameters. Units of x, y, z must be consistent.
{
"success": true,
"data": {
"x": 1920,
"y": 1080,
"z": 2202.91,
"ratio": "16:9",
"megapixels": 2.07
}
}
{
"success": false,
"error": "Need at least 2 inputs"
}
GET /api/aspect.php?x=1920&y=1080
{
"success": true,
"data": {
"z": 2202.91,
"ratio": "16:9",
"megapixels": 2.07
}
}
GET /api/aspect.php?x=1920&z=2202.91
{
"success": true,
"data": {
"y": 1080,
"ratio": "16:9",
"megapixels": 2.07
}
}
GET /api/aspect.php?z=22.03&ratio=16:9
{
"success": true,
"data": {
"x": 19.2,
"y": 10.8,
"megapixels": 0.21
}
}
GET /api/aspect.php?x=1920
{
"success": false,
"error": "Need at least 2 inputs"
}
megapixels = x * y / 1,000,000.