Skip to content
pdfconversionapi

PDN to PNM API

POST a .pdn to /v2/convert/pdn/to/pnm and get the merged picture as a binary PPM (P6): a 15-byte header, then uncompressed RGB. PNM keeps no alpha, so the sign's clear corners turn white unless AlphaColor names another color.

Endpoint
POST /v2/convert/pdn/to/pnm
Accepts
pdn
Sample timing
23 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/pdn/to/pnm \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@lemonade-stand-sign.pdn \
  -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 OK23 ms median1 file, 253 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.023,
  "Files": [
    {
      "FileName": "lemonade-stand-sign.pnm",
      "FileExt": "pnm",
      "FileSize": 259215,
      "FileData": "UDYKMzYwIDI0MCAyNTUK////…"
    }
  ]
}

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 lemonade-stand-sign.pnm, rendered by the API
Input
lemonade-stand-sign.pdn (87 KB)
Output
lemonade-stand-sign.pnm (253 KB)
Source
A 360 x 240 price sign with rounded transparent corners that we drew and wrote as a layered PDN file ourselves: seven layers, including Overlay and Multiply blend modes, a semi-transparent shine and a hidden draft layer. (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
AlphaColorstring, default whiteColor that clear and partly clear pixels are blended onto. #1F3A5F turned the corners (31, 58, 95), exactly the merged sign laid over navy.Values: white, black, red, green, blue, gray, #RRGGBB or R,G,B
BackgroundColorstring, default whiteFallback for AlphaColor; on its own it gave the same bytes as AlphaColor with that color.Values: Same as AlphaColor
ImageWidthintegerWidth in pixels; the file size follows. 180 gave 180 × 120 and 64,815 bytes.Values: 1–20000
ImageHeightintegerHeight in pixels, or with a width the box the sign is fitted into.Values: 1–20000
ScaleProportionsboolean, default truefalse returns exactly the box you send, 240 × 240 in 172,815 bytes, for code that needs a fixed input shape.
ScaleIfLargerboolean, default falsetrue keeps the 360 × 240 sign when a larger size is asked for.
ScaleImageboolean, default truefalse crops from the top-left: 180 × 90 is 48,614 bytes.
ColorSpaceenum, default defaultgray and monochrome write a one-channel PGM (P5) of 86,415 bytes, a third of the RGB file; monochrome holds only the values 0 and 255.Values: default, rgb, gray, monochrome (also srgb, truecolors, grayscale); cmyk returns 400
FileNamestringBase name of the result; without it the file comes back as lemonade-stand-sign.pnm.
StoreFileboolean, default falsetrue returns a link that works for 3 hours.

What carries over, and what doesn't

Kept

  • The merged RGB exactly: over white, every byte matched our own blend of the PNG route's output
  • 8 bits per channel, maximum value 255, the same depth as the PDN
  • Width and height in the header, 360 240, then the maximum value 255
  • Reader support: both readers we tried opened the P6 file and read the same pixels

Lost or not yet supported

  • Alpha. The 3,311 clear and 3,866 soft-edged pixels are blended onto AlphaColor, white by default.
  • Compression, layers and DPI. ImageResolution and TransparentColor change nothing here.

Limits

  • One PDN per request; up to 100,000,000 pixels after merging.
  • Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
  • 120 seconds per conversion, then 504.
  • Output is binary P6 RGB, or P5 gray with ColorSpace=gray or monochrome, always with maximum value 255; there is no plain-text or PAM variant.

Where teams use it

Test scenes for vision code

Image-processing and computer-vision code often reads Netpbm because the pixels follow a short text header. Test scenes drawn in Paint.NET can be turned into raw RGB without a decoder for PNG or PDN.

Datasets with a fixed background

Some datasets need every image on the same backdrop. AlphaColor=black or #00FF00 decides what the clear parts of a cut-out become, instead of white.

Questions

Which Netpbm type is the file?

Binary PPM. The header is P6 on the first line and 360 240 255 on the second: 15 bytes for the sign. The 259,200 bytes after it are the RGB pixels, three bytes each, from the top row down.

What color do the transparent corners get?

White, unless you send AlphaColor or BackgroundColor. Soft edges are blended, so an edge pixel at alpha 17 over navy comes out almost all navy.

How big will the file be?

The header plus width × height × 3 bytes. For the sign that is 15 + 259,200 = 259,215 bytes; a 180 × 90 crop has a header one byte shorter, since 90 has one digit fewer, and comes to 48,614. Gray output takes one byte a pixel: 86,415 bytes.

Convert your first PDN file in a minute.