Skip to content
pdfconversionapi

EXR to PNM API

POST an .exr to /v2/convert/exr/to/pnm and get a binary PPM: a short P6 text header with the width, height and a maxval of 255, then 3 raw bytes per pixel. The render's transparency is blended onto white unless you send AlphaColor.

Endpoint
POST /v2/convert/exr/to/pnm
Accepts
exr
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/exr/to/pnm \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@glowing-bulb-render.exr \
  -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, 211 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.023,
  "Files": [
    {
      "FileName": "glowing-bulb-render.pnm",
      "FileExt": "pnm",
      "FileSize": 216015,
      "FileData": "UDYKMjQwIDMwMCAyNTUK////…"
    }
  ]
}

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 glowing-bulb-render.pnm, rendered by the API
Input
glowing-bulb-render.exr (187 KB)
Output
glowing-bulb-render.pnm (211 KB)
Source
A glowing light bulb we drew in code and saved as a 240 × 300 OpenEXR render: half-float RGBA, premultiplied alpha, ZIP compression, values up to 12.0. (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 whiteBackdrop for clear and soft pixels. The corners of the sample are (255, 255, 255) by default; #202020 makes them dark gray.Values: white, black, red, green, blue, gray, #RRGGBB or R,G,B
BackgroundColorstring, default whiteThe same backdrop under another name, used only if AlphaColor is not sent.Values: Same as AlphaColor
ImageWidthintegerWidth in pixels. ImageWidth=120 gave a 120 150 255 header and 54,015 bytes.Values: 1–20000
ImageHeightintegerHeight in pixels; ImageHeight=100 gave an 80 × 100 file of 24,014 bytes.Values: 1–20000
ScaleProportionsboolean, default truefalse fills a box exactly, for example a square 200 × 200 frame from the 4:5 render.
ScaleIfLargerboolean, default falsetrue skips upscaling; ImageWidth=800 alone wrote 2,400,016 bytes of 800 × 1000 pixels.
ScaleImageboolean, default truefalse with a width and height crops from the top left (200 × 100 is 60,015 bytes).
ColorSpaceenum, default defaultgray writes a one-byte-per-pixel P5 file (72,015 bytes). monochrome is P5 too: it thresholds at 128, blends the soft edges onto the backdrop, then thresholds at 128 again, so only 0 and 255 remain.Values: default, rgb, gray, monochrome; cmyk returns 400
FileNamestringFile name stem, glowing-bulb-render by default, always with the .pnm extension.
StoreFileboolean, default falseAsks for a 3-hour download link instead of inline data.

What carries over, and what doesn't

Kept

  • The full 240 × 300 frame as uncompressed RGB triplets right after the header
  • Soft edges blended by their alpha rather than cut off
  • Values from 0 to 1, rounded to 8 bits

Lost or not yet supported

  • Alpha. A P6 file has no fourth channel; the backdrop fills every clear pixel.
  • Light in the glow. Over white, the halo pixel at (34, 112) came out (206, 181, 153); adding the EXR's premultiplied light to white would give (255, 233, 176).
  • 16-bit range. The maxval is always 255, although PPM allows up to 65535.
  • Highlights above 1.0 and the linear-to-sRGB step.
  • Size: 216,015 bytes for 72,000 pixels, more than the 191,302-byte EXR.

Limits

  • One EXR per request.
  • 10 MB on the Free plan or 100 MB on paid plans per request.
  • 100,000,000-pixel ceiling, answered with 413.
  • Sizes 1 to 20,000 px for resizing.
  • 120-second time limit.

Where teams use it

Input for command-line image tools

Netpbm-style tools and research code that read raw RGB behind a text header can use the file directly, so those machines need no EXR library.

Fixtures for image-processing tests

A binary PPM is easy to load byte by byte, so test suites can compare a render's pixels against expected values without decoding a compressed format.

Questions

What does the header look like?

Two text lines, P6 and 240 300 255 (width, height and maxval), 15 bytes in all. The 216,000 pixel bytes follow as RGB triplets, row by row from the top. With ColorSpace=gray or monochrome the magic number is P5 and each pixel is one byte.

Can I get 16-bit samples?

No. The maxval is 255 on this route. Use exr/to/png or exr/to/tiff for 16-bit output.

How are soft edges handled?

Each pixel is mixed with the backdrop by its alpha: color × alpha + backdrop × (1 − alpha). The color used is the EXR's stored value, which is already multiplied by alpha, so soft edges come out darker than a compositor would show them.

Convert your first EXR file in a minute.