Skip to content
pdfconversionapi

TGA to PDF API

POST a TGA to /v2/convert/tga/to/pdf and get a one-page PDF. The pixels go in compressed without loss, alpha becomes a soft mask, and the page is the image's size at 96 px per inch unless you name a sheet.

Endpoint
POST /v2/convert/tga/to/pdf
Accepts
tga
Sample timing
2 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/tga/to/pdf \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@shield-icon.tga \
  --form-string PageSize=a5 \
  -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 OK2 ms median1 file, 3.9 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.002,
  "Files": [
    {
      "FileName": "shield-icon.pdf",
      "FileExt": "pdf",
      "FileSize": 4009,
      "FileData": "JVBERi0xLjcKJYCAgIAKMSAw…"
    }
  ]
}

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 shield-icon.pdf, rendered by the API
Input
shield-icon.tga (16 KB)
Output
shield-icon.pdf (3.9 KB)
Source
A 256 x 256 pixel-art shield icon with a transparent background and a half-transparent shadow, drawn by us and saved as a 32-bit run-length-encoded TGA. (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
PageSizeenum, default defaultdefault and auto size the page to the image: the 256 px shield gives a 192 × 192 pt page (2.67 in). A named sheet centers the image on it at that same size; the sample uses A5.Values: default, auto, a3, a4, a5, letter, legal
PageOrientationenum, default defaultlandscape swaps a named sheet's width and height (Letter becomes 792 × 612 pt). It has no effect when the page follows the image.Values: default, portrait, landscape
RotateintegerClockwise turn. The square shield keeps its 192 pt page at 90 or 180; 30 enlarges the page to 262.28 pt to fit the turned corners. Without it the TGA is drawn the way it displays, since the origin bits in its header are applied when it is read.Values: -360 to 360 whole degrees, or none
MarginHorizontalinteger, default 0Clear space at the sides, in mm. With no PageSize, 15 widened the page by 42.52 pt each side to 277.04 pt. On a sheet the art is shrunk if it would cross them: A5 with 60 mm left the shield 79.37 pt square, and 74 mm leaves no room, which returns 400.Values: 0–500 (mm)
MarginVerticalinteger, default 0Clear space at the top and bottom, in mm. On A5, which is 210 mm tall, 104 still fitted a 5.67 pt shield, while 105 gave 400 'MarginHorizontal and MarginVertical leave no room for the image on the page'.Values: 0–500 (mm)
FileNamestringPDF name without extension; FileName=my-scan returned my-scan.pdf.
StoreFileboolean, default falseReturn a URL valid for 3 hours instead of the base64 PDF.

What carries over, and what doesn't

Kept

  • Every pixel: color and alpha pulled back out of the sample PDF match the TGA exactly
  • Transparency, as an 8-bit soft mask next to the RGB image, so the shadow stays half-transparent
  • Full resolution: the 256 × 256 image is embedded at 256 × 256 whatever the sheet
  • The image's printed size on a larger sheet: on A5 the shield is still drawn 192 pt square, centered

Lost or not yet supported

  • The TGA itself. The PDF stores its own deflate-compressed copy of the pixels (4,009 bytes for the sample on A5).
  • Any resizing or color changes: ImageWidth, ColorSpace and other image options are not read on this route and are ignored.
  • Edge room unless you set margins. A 3000 × 3000 test texture fitted to A4 ran from the left edge to the right one; MarginHorizontal=25 and MarginVertical=25 pulled it 70.87 pt in.
  • The TGA image ID and footer.

Limits

  • One TGA per request, one page out.
  • Images are never enlarged to fill a sheet, only shrunk when they are too big for it.
  • Margins from 0 to 500 mm a side, and turns in whole degrees from -360 to 360.
  • 100,000,000 pixels per image; requests up to 10 MB on the Free plan or 100 MB on paid plans.
  • 120 seconds per conversion.

Where teams use it

Art review packets and style guides

Turn sprites or textures into PDF pages that anyone can open and annotate, with transparency kept so the art sits on the white page instead of a black box.

Printing a texture at a known size

With PageSize=a4 or letter the art is centered on a real sheet, ready for a printer, at 96 pixels per inch unless it has to shrink to fit.

Questions

How big is the page?

With no PageSize, one image pixel is 0.75 pt, the size it has at 96 pixels per inch. The 256 × 256 sample becomes a 192 × 192 pt page, 2.67 inches square.

Does the shadow print as gray or black?

As gray. Alpha is stored as a soft mask, so the shadow at alpha 112 lets the white page show through and prints as a mid gray, not solid black.

Why didn't ImageWidth make the image smaller?

This route doesn't read ImageWidth; it sizes the page from the pixels or from PageSize. To get a smaller image, resize first with /v2/convert/tga/to/png and ImageWidth, then convert that PNG.

Can I rotate the sprite on the page?

Yes, Rotate turns it clockwise about its center. A quarter turn of the 256 × 256 shield keeps the 192 pt square page, and other angles widen the page to the turned outline: 262.28 pt at 30 degrees. Fractions such as 12.5 are refused with a 400.

Can I put several TGAs into one PDF?

Not on this route, which takes one file. /v2/convert/images/to/pdf takes several images and gives each its own page.

Convert your first TGA file in a minute.