KRA to TGA API
Send a Krita file to /v2/convert/kra/to/tga and get a 32-bit Targa (image type 2, uncompressed) of the merged layers, with an 8-bit alpha channel and rows stored from the top.
- Endpoint
- POST /v2/
convert/ kra/ to/ tga - Accepts
- kra
- Sample timing
- 23 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/kra/to/tga \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@rocket-sticker.kra \
-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/kra/to/tga",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("rocket-sticker.kra", "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 = "rocket-sticker.kra";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/kra/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.023,
"Files": [
{
"FileName": "rocket-sticker.tga",
"FileExt": "tga",
"FileSize": 409618,
"FileData": "AAACAAAAAAAAAAAAQAFAASAo…"
}
]
}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
- rocket-sticker.kra (108 KB)
- Output
- rocket-sticker.tga (400 KB)
- Source
- A cartoon rocket sticker on a transparent canvas that we drew and saved as a six-layer KRA file (one layer hidden, one faded by a transparency mask). (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 | Texture width; for a power-of-two sprite, 256 gave a 262,162-byte TGA and 64 gave 16,402 bytes.Values: 1–20000 |
ImageHeightinteger | Texture height; alone it sets the scale, with a width it bounds a box.Values: 1–20000 |
ScaleProportionsboolean, default true | false forces non-square dimensions such as 200 × 100 (80,018 bytes). |
ScaleIfLargerboolean, default false | true keeps small art from being blown up. |
ScaleImageboolean, default true | false crops from the top-left instead of resizing. |
ColorSpaceenum, default default | Changes pixel values only. Nothing is compressed, so gray and monochrome files are the same 409,618 bytes as the color one.Values: default, rgb, gray, monochrome (also srgb, truecolors, grayscale); cmyk returns 400 |
TransparentColorstring | Sets alpha to 0 for one exact color; #FFFFFF cleared 104 white pixels.Values: #RRGGBB, R,G,B or a color name |
FileNamestring | Rename the .tga that comes back. |
StoreFileboolean, default false | Get a 3-hour link instead of base64 data. |
What carries over, and what doesn't
Kept
- All four channels: in both readers we tried, every pixel matched our PNG of the same KRA
- Partial transparency, 4,962 pixels in the sample
- Top-to-bottom row order, flagged in the image descriptor (0x28)
Lost or not yet supported
- Compression. Every pixel is stored raw, the 83,159 empty ones included, so the sample is 409,618 bytes where the PNG of the same merge is 27,925.
- A TGA 2.0 footer, image ID or developer area.
- 16-bit depth, resolution and the color profile.
- Vector and filter layers from Krita, which are not drawn.
Limits
- One KRA per request, canvas up to 100,000,000 pixels with no side over 300,000 px.
- Targa stores each side in 16 bits, so 65,535 px is the largest: a 65,536 × 10 canvas returned 413
TGA images can be at most 65,535 pixels on a side, and this one is 65,536×10, and 65,535 × 10 converted. - Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- 504 after 120 seconds.
- Always 32-bit and uncompressed, opaque art included; no RLE or 24-bit option.
Where teams use it
Game textures and sprites
For engines and texture tools that import TGA, the result carries its alpha channel, so a sprite painted in Krita on a transparent canvas keeps its cutout edge.
Batch exports for modding
Convert a folder of .kra sources to TGA in a build script and resize to texture sizes with ImageWidth, instead of exporting each file by hand.
Questions
Will my texture tool open the TGA?
It is the plainest layout Targa has: image type 2, no color map and no image ID, an 18-byte header, then 4 bytes per pixel with the top-left origin flag (descriptor 0x28). Both readers we tried decoded the sample to exactly the pixels of our PNG output.
Is the alpha channel kept?
Yes. The TGA is 32 bits per pixel with 8 alpha bits, so the transparent canvas and the soft shadow survive. A tool that reads the file sees the same alpha values as the PNG output.
Why is the TGA as large as the raw pixels?
Because the writer does no compression, the size follows from the canvas alone: 18 bytes plus width × height × 4. That is 409,618 bytes for the 320 px rocket, mostly empty canvas, and 16,402 at ImageWidth=64. For smaller files with the same alpha, our KRA to PNG and KRA to WebP routes gave 27,925 and 24,186 bytes.
Convert your first KRA file in a minute.