PSB to TGA API
POST a .psb to /v2/convert/psb/to/tga to get a 32-bit Targa file as base64. The sample halves the banner with ImageWidth=192: 192 × 64 pixels after an 18-byte header, 49,170 bytes in all, alpha 255 throughout.
- Endpoint
- POST /v2/
convert/ psb/ to/ tga - Accepts
- psb
- Sample timing
- 91 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/psb/to/tga \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@ridge-loop-trail-banner.psb \
--form-string ImageWidth=192 \
-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/psb/to/tga",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("ridge-loop-trail-banner.psb", "rb"))],
data={
"ImageWidth": "192",
},
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 = "ridge-loop-trail-banner.psb";
form.append("File", new Blob([await readFile(file)]), file);
form.append("ImageWidth", "192");
const url = "https://api.pdfconversionapi.com/v2/convert/psb/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.091,
"Files": [
{
"FileName": "ridge-loop-trail-banner.tga",
"FileExt": "tga",
"FileSize": 49170,
"FileData": "AAACAAAAAAAAAAAAwABAACAo…"
}
]
}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
- ridge-loop-trail-banner.psb (171 KB)
- Output
- ridge-loop-trail-banner.tga (48 KB)
- Source
- A layered trail-map banner we drew for this site: 384 x 128 pixels at 16 bits per channel on an opaque Background layer, with seven layers including a smooth sky gradient and a hidden old route. Written in the large document (PSB) format by our own script from the published file format specification. (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; the height follows the banner's 3:1 shape. The sample's 192 gave 192 × 64. Scaling uses a Lanczos3 filter on the merged image.Values: 1–20000 |
ImageHeightinteger | Texture height; together with a width, a bounding box.Values: 1–20000 |
ScaleProportionsboolean, default true | false gives exactly the size asked for: 192 × 192 squeezed the banner into a square of 147,474 bytes. |
ScaleIfLargerboolean, default false | true never scales a document up. |
ScaleImageboolean, default true | false crops from the top-left corner. |
TransparentColorstring | Pixels of exactly this color get alpha 0. At full size #FFFFFF cut out the 295 white pixels of the label and markers; at the sample's 192 px, resizing leaves only 27 pixels exactly white, and only those were cut out.Values: #RRGGBB, R,G,B or a color name |
ColorSpaceenum, default default | gray stores gray values in the 32-bit layout, so the full-size file stays 196,626 bytes.Values: default, rgb, gray, monochrome; cmyk returns 400 |
FileNamestring | Base name of the TGA file. |
StoreFileboolean, default false | true returns a 3-hour link. |
What carries over, and what doesn't
Kept
- The visible layers, merged by the API; the hidden Old route stays out
- An alpha channel in every file: 255 everywhere for this opaque banner, ready for
TransparentColorkeying - Top-left row order, stated in the header
Lost or not yet supported
- 16-bit precision: TGA holds 8 bits per channel.
- Compression. Pixels are stored raw, with no run-length option: the full-size banner is 196,626 bytes, the lossless WebP of it 16,340.
- The 150 ppi setting, layers, and the TGA 2.0 footer.
Limits
- One PSB per request.
- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- Flattened documents up to 100,000,000 pixels, or 413.
- Resize targets from 1 to 20,000 px per side.
- Sides up to 65,535 px: a 70,000 × 2 test PSB returned 413 'TGA images can be at most 65,535 pixels on a side'; with
ImageWidth=20000it converted. - 120 seconds per conversion, then 504.
- Our PSB tests use pixel layers, masks, groups and blend modes; type layers and layer effects are untested.
Where teams use it
Texture sheets kept as PSB
When a painted texture sheet is saved as PSB, a build step can turn it into a TGA at the size the engine needs, using ImageWidth and ImageHeight, without a manual export.
Background plates for compositing
Wide painted backdrops kept in PSB can go to compositing software that takes TGA, scaled down in the same request.
Questions
Why is there an alpha channel when my PSB is opaque?
The route always writes 32 bits per pixel. For an opaque document every alpha value is 255, so the texture looks the same in tools that use alpha and tools that ignore it.
Is the TGA compressed?
No. The route writes uncompressed true color (image type 2): 18 + 384 × 128 × 4 = 196,626 bytes for the full banner, 49,170 for the 192 px sample. All three readers we tried decoded the sample to the same pixels as the BMP route gives.
Can I keep 16 bits per channel?
Not in TGA. Use PSB to PNG or PSB to TIFF, which keep the banner's 16 bits.
Convert your first PSB file in a minute.