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
fiimport base64
import os
import requests
key = os.environ["PDFCONVERSIONAPI_KEY"]
response = requests.post(
"https://api.pdfconversionapi.com/v2/convert/psb/to/pnm",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("ridge-loop-trail-banner.psb", "rb"))],
timeout=180,
)
result = response.json()
if not response.ok:
raise SystemExit(f"{result['Code']}: {result['Message']}")
os.makedirs("converted", exist_ok=True)
for file in result["Files"]:
path = os.path.join("converted", file["FileName"])
with open(path, "wb") as out:
out.write(base64.b64decode(file["FileData"]))
print(path, file["FileSize"], "bytes")
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
const form = new FormData();
const file = "ridge-loop-trail-banner.psb";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/psb/to/pnm";
const key = process.env.PDFCONVERSIONAPI_KEY;
const response = await fetch(url, {
method: "POST",
headers: { Authorization: `Bearer ${key}` },
body: form,
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.Code}: ${result.Message}`);
}
await mkdir("converted", { recursive: true });
for (const file of result.Files) {
const path = join("converted", file.FileName);
await writeFile(path, Buffer.from(file.FileData, "base64"));
console.log(path, file.FileSize, "bytes");
}
{
"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.

- 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.
| Parameter | What it does |
|---|---|
ImageWidthinteger | Width of the result; the height follows the 3:1 banner. 192 gave a 36,878-byte file.Values: 1–20000 |
ImageHeightinteger | Height of the result; with a width as well, the box the document is fitted into.Values: 1–20000 |
ScaleProportionsboolean, default true | false stretches to the exact width and height. |
ScaleIfLargerboolean, default false | true leaves documents that already fit at their size. |
ScaleImageboolean, default true | false crops a top-left region instead. |
AlphaColorstring, default white | Background 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 default | gray 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 |
FileNamestring | Base name; the extension is .pnm. |
StoreFileboolean, default false | true 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.