Skip to content
pdfconversionapi

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
fi
200 OK1 ms median1 file, 469 KB
{
  "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.

First page of trail-map-card.tga, rendered by the API
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.

ParameterWhat it does
ImageWidthintegerResize before writing: 128 px gives a 128 × 96 TGA of 49,170 bytes.Values: 1–20000
ImageHeightintegerResize by height, or fit a box with the width.Values: 1–20000
ScaleProportionsboolean, default truefalse stretches to the exact box, useful for power-of-two texture sizes such as 256 × 256.
ScaleIfLargerboolean, default falsetrue never makes the texture bigger than the QOI.
ScaleImageboolean, default truefalse crops a top-left region of the requested size.
ColorSpaceenum, default defaultGray 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
TransparentColorstringSets alpha to 0 for one exact color before writing.Values: #RRGGBB, R,G,B or a basic color name
FileNamestringName for the .tga file.
StoreFileboolean, default falseReturn 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.