Skip to content
pdfconversionapi

PSB to PNM API

Post a .psb to /v2/convert/psb/to/pnm; the reply holds a binary PPM file (P6) with RGB samples at 8 bits. For the 384 × 128 banner that is a 15-byte header and 147,456 bytes of pixels, 147,471 in all.

Endpoint
POST /v2/convert/psb/to/pnm
Accepts
psb
Sample timing
89 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/psb/to/pnm \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@ridge-loop-trail-banner.psb \
  -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 OK89 ms median1 file, 144 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.089,
  "Files": [
    {
      "FileName": "ridge-loop-trail-banner.pnm",
      "FileExt": "pnm",
      "FileSize": 147471,
      "FileData": "UDYKMzg0IDEyOCAyNTUKHDNh…"
    }
  ]
}

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 ridge-loop-trail-banner.pnm, rendered by the API
Input
ridge-loop-trail-banner.psb (171 KB)
Output
ridge-loop-trail-banner.pnm (144 KB)
Source
A layered trail-map banner we drew for this site: 384 x 128 pixels at 16 bits per channel on an opaque Background layer, with seven layers including a smooth sky gradient and a hidden old route. Written in the large document (PSB) format by our own script from the published file format specification. (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 result; the height follows the 3:1 banner. 192 gave a 36,878-byte file.Values: 1–20000
ImageHeightintegerHeight of the result; with a width as well, the box the document is fitted into.Values: 1–20000
ScaleProportionsboolean, default truefalse stretches to the exact width and height.
ScaleIfLargerboolean, default falsetrue leaves documents that already fit at their size.
ScaleImageboolean, default truefalse crops a top-left region instead.
AlphaColorstring, default whiteBackground for transparent pixels. The banner is opaque, so black changed nothing; a PSB with clear areas is blended onto this color.Values: A color name, #RRGGBB or R,G,B
ColorSpaceenum, default defaultgray and monochrome write a one-channel graymap (P5) instead, 49,167 bytes; monochrome holds only the values 0 and 255.Values: default, rgb, gray, monochrome; cmyk returns 400
FileNamestringBase name; the extension is .pnm.
StoreFileboolean, default falsetrue returns a link valid for 3 hours.

What carries over, and what doesn't

Kept

  • The merged colors, each rounded to the nearest 8-bit value: every byte equals the 16-bit PNG output divided by 257 and rounded
  • The layer stack as merged by the API, without the hidden Old route
  • Width and height in the header, so the array shape is known before the data
  • Readability: P6 is the plain PPM form, and all three readers we tried decoded it to the same bytes

Lost or not yet supported

  • The low 8 bits of each 16-bit sample. MAXVAL is 255.
  • Layers, compression, the 150 ppi setting and any profile.

Limits

  • One PSB per request.
  • Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
  • Flattened documents up to 100,000,000 pixels, or 413.
  • Resize targets from 1 to 20,000 px per side.
  • 120 seconds per conversion, then 504.
  • Type layers, smart objects and layer effects in PSB files are not tested yet.

Where teams use it

Checking a large document's pixels in code

Load the PPM into an array to measure colors, run statistics or compare two versions of a big PSB, without linking an image decoder.

Input for command-line image tools

Netpbm-style tools read PPM from a file or a pipe. Scale the document with ImageWidth first: at the 100,000,000-pixel limit, the file would hold 300,000,000 bytes of pixels.

Questions

Can I get 16-bit values (MAXVAL 65535)?

No. The PPM is always 8 bits per sample. For 16 bits, convert the PSB to PNG or TIFF, both of which kept the sample's 16-bit values exactly.

How do I read the file?

Read the magic number P6, then the width, height and maximum value as text separated by white space; after one more byte of white space come width × height × 3 bytes of RGB, top row first. The banner's header is P6 and 384 128 255 on two lines, 15 bytes.

Is any option refused on this route?

Only invalid values. ConvertAPI documents no options for PSB to PNM, so ones this route does not use, like ImageResolution, are accepted and ignored: 150 returned the same bytes.

Convert your first PSB file in a minute.