Skip to content
pdfconversionapi

SVG to TGA API

POST an SVG to /v2/convert/svg/to/tga to get an uncompressed 32-bit Targa with alpha. The sample is drawn at ImageWidth=256: 262,162 bytes, an 18-byte header and then 4 bytes for each of its 65,536 pixels.

Endpoint
POST /v2/convert/svg/to/tga
Accepts
svg
Sample timing
8 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/svg/to/tga \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@water-day-icon.svg \
  --form-string ImageWidth=256 \
  -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 OK8 ms median1 file, 256 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.008,
  "Files": [
    {
      "FileName": "water-day-icon.tga",
      "FileExt": "tga",
      "FileSize": 262162,
      "FileData": "AAACAAAAAAAAAAAAAAEAASAo…"
    }
  ]
}

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 water-day-icon.tga, rendered by the API
Input
water-day-icon.svg (2.1 KB)
Output
water-day-icon.tga (256 KB)
Source
An app icon for a fictional plant-watering reminder, with two gradients, a soft drop shadow and a text label, which we drew by hand. (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
ImageWidthintegerTexture width; the vectors are drawn at that size. The sample sends 256 for a power-of-two texture.Values: 1–20000
ImageHeightintegerTexture height, with the width derived unless you send both.Values: 1–20000
ScaleProportionsboolean, default truefalse stretches to the exact width and height, for non-square textures from square art.
ScaleIfLargerboolean, default falsetrue prevents enlarging past the SVG's own size.
ScaleImageboolean, default truefalse returns a top-left crop of the unscaled render (100 × 100 gave 40,018 bytes).
TransparentColorstringPixels of exactly this color get alpha 0. white clears 491 pixels at the sample's 256 px (695 at the icon's own 300 px), the white letters among them.Values: Color names (white, black, red, green, blue, gray), #RRGGBB or R,G,B
ColorSpaceenum, default defaultgray and monochrome change the colors but keep 32 bits per pixel. cmyk returns 400.Values: default, rgb, gray, monochrome
FileNamestringName for the .tga.
StoreFileboolean, default falsetrue gives a link valid for 3 hours.

What carries over, and what doesn't

Kept

  • Every pixel and alpha value: decoding the TGA by hand gave exactly the PNG render at 256 px
  • Partial transparency, so the soft shadow stays soft
  • Top-to-bottom row order (image descriptor 0x28), so nothing comes out upside down
  • Sharp edges at the texture size

Lost or not yet supported

  • Compactness: 262,162 bytes, where a PNG of the same 256 px render takes 22,434.
  • A TGA 2.0 footer or extension area, so no author or date fields.
  • A DPI or aspect field.
  • Text in uninstalled fonts and images that are linked rather than embedded.

Limits

  • One SVG 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 at most per render (413).
  • Each side at most 65,535 px: an SVG declaring a width of 65536 returned 413 "TGA images can be at most 65,535 pixels on a side, and this one is 65,536×2".
  • Width and height from 1 to 20,000.
  • 120 seconds per conversion, 504 after that.

Where teams use it

Game UI and decal textures

Engines and modding tools that import TGA can take icons and decals drawn as SVG, rendered at the texture size the engine expects, with a real alpha channel.

Overlays for video tools

Video and compositing software that accepts Targa stills with alpha can use a logo or lower-third graphic rendered from SVG at the frame's pixel size.

Questions

Is the TGA compressed?

No. It is image type 2, uncompressed true color: 262,162 bytes for 256 × 256, nearly 12 times the PNG of the same pixels. If file size matters more than a plain layout, re-save it with run-length encoding in another tool.

Will a strict TGA reader open the file?

It should: an uncompressed file has no run-length packets for a reader to trip over. Three readers we tried opened the sample, and the two we compared pixel by pixel gave exactly the PNG render.

Which way up are the rows stored?

From the top. The image descriptor byte is 0x28: the origin bit says top-left, and the low bits say 8 bits of alpha per pixel.

Convert your first SVG file in a minute.