QOI to TGA API
POST a QOI to /v2/convert/qoi/to/tga and get an uncompressed 32-bit TGA (image type 2) with 8 alpha bits and a top-left origin. The pixels, soft alpha included, are exactly the QOI's.
- Endpoint
- POST /v2/
convert/ qoi/ to/ tga - Accepts
- qoi
- Sample timing
- 1 ms median of 5 runsHow we measure
- Request size
- Up to 10 MB on the Free plan or 100 MB on paid plans, all files together
Request and response
Every sample below ran against the API before this page was published. Set PDFCONVERSIONAPI_KEY to your key and run it as is.
curl -sS -X POST \
https://api.pdfconversionapi.com/v2/convert/qoi/to/tga \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@trail-map-card.qoi \
-o response.json
# FileData is base64. Save the first file in converted/,
# or print the JSON error.
if jq -e '.Files' response.json > /dev/null; then
mkdir -p converted
name=$(jq -r '.Files[0].FileName' response.json)
jq -r '.Files[0].FileData' response.json \
| base64 --decode > "converted/$name"
else
cat response.json
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/qoi/to/tga",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("trail-map-card.qoi", "rb"))],
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "trail-map-card.qoi";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/qoi/to/tga";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"ConversionCost": 1,
"ConversionTime": 0.001,
"Files": [
{
"FileName": "trail-map-card.tga",
"FileExt": "tga",
"FileSize": 480018,
"FileData": "AAACAAAAAAAAAAAAkAEsASAo…"
}
]
}Response from our test run on 2026-11-03. ConversionTime shows the median of 5 runs. FileData is shortened here; the real response carries the whole file as base64.
The sample, converted
The same file the code sends. Download the input and the output and compare them yourself.

- Input
- trail-map-card.qoi (66 KB)
- Output
- trail-map-card.tga (469 KB)
- Source
- A 400 x 300 trail map card with a sunrise sky, rounded transparent corners and a soft drop shadow, drawn by us and saved as a 4-channel QOI. (CC0-1.0). How it was made
- Made by
- 2026-11-04, API build
9eeeb0640aba
Parameters
Send these as form fields next to the file. Names are case-insensitive. If you set one of the documented options below that we don't support yet, the request fails with a 400 that names it instead of returning a file made without it.
| Parameter | What it does |
|---|---|
ImageWidthinteger | Resize before writing: 128 px gives a 128 × 96 TGA of 49,170 bytes.Values: 1–20000 |
ImageHeightinteger | Resize by height, or fit a box with the width.Values: 1–20000 |
ScaleProportionsboolean, default true | false stretches to the exact box, useful for power-of-two texture sizes such as 256 × 256. |
ScaleIfLargerboolean, default false | true never makes the texture bigger than the QOI. |
ScaleImageboolean, default true | false crops a top-left region of the requested size. |
ColorSpaceenum, default default | Gray or black-and-white values; the TGA stays 32-bit and uncompressed, so gray and monochrome are 480,018 bytes like the color file.Values: default, rgb, gray, monochrome; cmyk returns 400 |
TransparentColorstring | Sets alpha to 0 for one exact color before writing.Values: #RRGGBB, R,G,B or a basic color name |
FileNamestring | Name for the .tga file. |
StoreFileboolean, default false | Return a 3-hour URL instead of the file data. |
What carries over, and what doesn't
Kept
- Every pixel and alpha value: the sample TGA decodes to the QOI's 120,000 RGBA values
- Soft alpha at 8 bits, so the card's shadow and rounded corners stay smooth
- 400 × 300, with the rows marked top-down in the header
Lost or not yet supported
- Size. The sample grows from 67,304 bytes to 480,018: an 18-byte header and 4 bytes for every pixel, with no compression.
- A 24-bit option. A 3-channel QOI still becomes a 32-bit TGA, with every alpha byte at 255.
- Run-length encoding. No option turns it on; for a smaller lossless copy of the card, PNG is 49,290 bytes.
- The QOI colorspace byte; the TGA has no ID string or footer either.
Limits
- One QOI per request.
- TGA stores width and height in 16 bits: a 65,535 px wide QOI converted, and 65,536 returned 413
TGA images can be at most 65,535 pixels on a side, and this one is 65,536×1. - 100,000,000 pixels per image; requests up to 10 MB on the Free plan or 100 MB on paid plans.
- 120 seconds per conversion.
Where teams use it
Textures for engines that load TGA
If art is produced or cached as QOI but an engine, modding tool or texture packer only reads TGA, convert at build time and keep the alpha.
Resized textures in one step
Set ImageWidth and ImageHeight with ScaleProportions=false to get a power-of-two TGA from any QOI in the same request.
Questions
Why is the TGA bigger than the QOI?
QOI encodes small differences between neighboring pixels, which suits gradients. Our TGA output is not compressed at all: 18 bytes of header plus 4 bytes per pixel, so the card's 67,304 bytes became 480,018. Convert to PNG or WebP if size matters.
Is the TGA top-down or bottom-up?
Top-down. The image descriptor byte sets the top-left origin flag (0x28 with the 8 alpha bits), and the rows are written top row first.
Will strict TGA readers open the file?
It uses the plainest layout: image type 2 with no color map, no ID field, no run-length packets and no footer. Three readers we tried opened the sample, a strict one among them, and all read the same 120,000 RGBA values.
Convert your first QOI file in a minute.