Skip to content
pdfconversionapi

WebP to TGA API

POST a WebP to /v2/convert/webp/to/tga and get a 32-bit Targa with an 8-bit alpha channel, with the pixels stored uncompressed. Every alpha value from the WebP is kept, so soft edges stay soft.

Endpoint
POST /v2/convert/webp/to/tga
Accepts
webp
Sample timing
3 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/webp/to/tga \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@guest-badge.webp \
  -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 OK3 ms median1 file, 406 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.003,
  "Files": [
    {
      "FileName": "guest-badge.tga",
      "FileExt": "tga",
      "FileSize": 416018,
      "FileData": "AAACAAAAAAAAAAAAkAEEASAo…"
    }
  ]
}

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 guest-badge.tga, rendered by the API
Input
guest-badge.webp (9.4 KB)
Output
guest-badge.tga (406 KB)
Source
A guest pass for a made-up trade show that we drew for this page, saved as a lossy WebP with a transparent background and a soft shadow. (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
ImageWidthintegerWidth of the Targa; at 200 the badge became 200 × 130 and 104,018 bytes.Values: 1–20000
ImageHeightintegerHeight of the Targa, or the box height with ImageWidth.Values: 1–20000
ScaleProportionsboolean, default truefalse resizes to the exact box, changing the shape.
ScaleIfLargerboolean, default falsetrue stops textures from being scaled up.
ScaleImageboolean, default truefalse crops a top-left region instead of resizing.
TransparentColorstringMakes one exact color clear in addition to the WebP's alpha; #FFFFFF raised the badge's clear pixels from 2,599 to 45,367.Values: Color name, #RRGGBB or R,G,B
ColorSpaceenum, default defaultgray gave a gray texture with its alpha, still 416,018 bytes; monochrome black and white. cmyk is refused.Values: default, rgb, gray, monochrome
FileNamestringName of the .tga; guest-badge.tga without it.
StoreFileboolean, default falsetrue stores the file for 3 hours and returns Files[].Url.

What carries over, and what doesn't

Kept

  • Every color and alpha value: read back, the Targa equals the reference WebP decode exactly.
  • Soft shadow and anti-aliased corners: 11,188 partly transparent pixels keep their alpha.
  • Top-left row order, flagged in the header.
  • The 400 × 260 size.
  • EXIF orientation: a 300 × 200 WebP tagged 6 came back as a 200 × 300 texture, turned upright.

Lost or not yet supported

  • Size: the 9,596-byte WebP became 416,018 bytes, 43 times larger, because the Targa holds 4 raw bytes per pixel.
  • Animation frames after the first.
  • The WebP's ICC, EXIF and XMP data.

Limits

  • One WebP per request.
  • Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
  • 100,000,000 pixels per image, checked before decoding.
  • Conversions are stopped after 120 seconds with a 504.

Where teams use it

Game textures from web assets

Sprites, UI pieces and decals published as WebP can be turned into Targa for tools and engines that import TGA, with their alpha ready for blending.

Overlays for video editing

Lower thirds and badges with soft shadows keep their partial transparency in the Targa, so they blend over footage without a hard edge.

Questions

Is the alpha channel kept?

Yes, in full. The header declares 8 alpha bits and every pixel's alpha matches the WebP, including the partly transparent shadow.

Do strict TGA readers open it?

Yes, in our tests. The file is a plain 18-byte header plus raw rows, with no packets that could run past a row end. An image library that rejects such packets, a video tool and /v2/convert/tga/to/png all decoded the badge with its alpha intact.

Is the TGA compressed?

No. It is image type 2, uncompressed true color, so the badge takes 416,018 bytes: 18 for the header and 4 for each of its 104,000 pixels. There is no setting for run-length packets.

Can I get a 24-bit TGA without alpha?

No; output is always 32-bit. Flatten first with /v2/convert/webp/to/jpg and AlphaColor if a tool needs an opaque image.

Convert your first WebP file in a minute.