BMP to TGA API
Send a bitmap to POST /v2/convert/bmp/to/tga and receive an uncompressed 32-bit Targa (image type 2) with the same pixels. Opaque bitmaps get an alpha channel of 255 throughout, ready for tools that want RGBA.
- Endpoint
- POST /v2/
convert/ bmp/ to/ tga - Accepts
- bmp
- 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/bmp/to/tga \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@shelf-label.bmp \
-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/bmp/to/tga",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("shelf-label.bmp", "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 = "shelf-label.bmp";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/bmp/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": "shelf-label.tga",
"FileExt": "tga",
"FileSize": 400018,
"FileData": "AAACAAAAAAAAAAAAkAH6ACAo…"
}
]
}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
- shelf-label.bmp (293 KB)
- Output
- shelf-label.tga (391 KB)
- Source
- A 24-bit warehouse bin label with a QR code and a colored header, drawn by us for this page. (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 |
|---|---|
TransparentColorstring | Writes alpha 0 for every pixel of this exact color. #FFFFFF made the label's white body transparent; the teal header stayed solid apart from 465 pure-white pixels inside its "BIN A-14-03" lettering, which turned clear too.Values: Color name, #RRGGBB or R,G,B |
ImageWidthinteger | Width after scaling; the 200 × 125 version was 100,018 bytes, 4 bytes per pixel plus the 18-byte header.Values: 1–20000 |
ImageHeightinteger | Height after scaling; with ImageWidth, a box to fit into.Values: 1–20000 |
ScaleProportionsboolean, default true | false fills the box exactly. |
ScaleIfLargerboolean, default false | true never makes the bitmap bigger. |
ScaleImageboolean, default true | false keeps a top-left crop of that size (150 × 100 was 60,018 bytes). |
ColorSpaceenum, default default | Gray or black-and-white values in the same 32-bit layout, so the file stays 400,018 bytes; monochrome leaves only pure black and pure white.Values: default, rgb, gray, monochrome |
FileNamestring | Name for the .tga file. |
StoreFileboolean, default false | Return a URL for 3 hours. |
What carries over, and what doesn't
Kept
- All pixels: the 400,000 bytes of pixel data gave the BMP back with no difference
- Upright orientation, with rows stored top to bottom
- Alpha from 32-bit BMPs that declare an alpha mask
Lost or not yet supported
- Compactness. Nothing is compressed, so the 300,054-byte label became 400,018 bytes: an 18-byte header and 4 bytes for each of its 100,000 pixels.
- The BMP's DPI; this Targa has no extension area to hold one.
- Small size for 1-bit art: a 1-bit copy of the label (13,062 bytes as BMP) also became a 400,018-byte TGA, since every pixel is stored as 32 bits.
Limits
- One BMP per request.
- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- 413 above 100,000,000 pixels, judged from the BMP header.
- Resize targets from 1 to 20,000 px.
- 120-second limit per conversion.
Where teams use it
Game textures from bitmap art
Texture tools and engines that import Targa can take BMP artwork after this step, with an alpha channel ready for cut-outs via TransparentColor.
Pixels that need no decoder
Where a tool or a hand-written loader reads TGA but not PNG, this file is the simplest form to parse: an 18-byte header, then 4 bytes per pixel in blue, green, red, alpha order, top row first.
Questions
Is the TGA compressed?
No. It is image type 2, uncompressed true color at 32 bits per pixel, with 8 alpha bits declared and a top-left origin. Our 300,054-byte BMP became 400,018 bytes.
Can I get 24-bit or run-length encoded TGA?
No. Output is always 32-bit and uncompressed; there is no option for either.
Will other programs open the TGA?
In our tests, yes. Three readers, among them the image tools built into macOS, opened the sample and decoded every pixel exactly. The file has no run-length packets, so readers that handle only plain Targa data load it too.
Are options that don't apply rejected?
No. ConvertAPI documents no options for BMP to TGA, so names this route doesn't read, such as ImageQuality, are ignored.
Convert your first BMP file in a minute.