DXF to WebP API
Send a DXF to POST /v2/convert/dxf/to/webp and get a lossless WebP of model space back, 2400 × 1600, with the same pixels as the PNG route. For the garden plan that is 122,888 bytes instead of 132,185.
- Endpoint
- POST /v2/
convert/ dxf/ to/ webp - Accepts
- dxf
- Sample timing
- 0.128 s 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/dxf/to/webp \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@linden-garden-site-plan.dxf \
-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/dxf/to/webp",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("linden-garden-site-plan.dxf", "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 = "linden-garden-site-plan.dxf";
form.append("File", new Blob([await readFile(file)]), file);
const url = "https://api.pdfconversionapi.com/v2/convert/dxf/to/webp";
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.128,
"Files": [
{
"FileName": "linden-garden-site-plan.webp",
"FileExt": "webp",
"FileSize": 122888,
"FileData": "UklGRgDgAQBXRUJQVlA4TPTf…"
}
]
}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
- linden-garden-site-plan.dxf (24 KB)
- Output
- linden-garden-site-plan.webp (120 KB)
- Source
- A site plan for a fictional community garden, in feet, which we wrote as a DXF R2000 file with a short script (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 |
|---|---|
ColorSpaceenum, default default | gray halves the sample to 57,094 bytes; monochrome keeps only black and white pixels, 8,252 bytes. Both files are still RGB, because lossless WebP has no one-channel mode. cmyk returns 400.Values: default, rgb, truecolors, gray, grayscale, monochrome |
TransparentColorstring | Pixels of exactly this color become transparent. 33,40,48 removes the dark background (131,318 bytes for the sample).Values: A color name, #RRGGBB or R,G,B |
ImageResolutioninteger | Accepted for compatibility (10–800) but not stored, since WebP has no DPI field.Values: 10–800 |
FileNamestring | Output file name minus .webp; the DXF's name otherwise. |
StoreFileboolean, default false | Replace the base64 WebP in the reply with a link that lasts 3 hours. |
Not supported yet
Setting one of these to anything but its default returns 400.
| Option | What to do instead |
|---|---|
ImageQuality | Output is lossless; values other than 75 return 400. |
ImageAntialiasing | Values other than 8 return 400. |
SpaceToConvert | Model space only. |
ExportLayers | Only true passes. |
Also refused when set: CustomSpaceToConvert.
What carries over, and what doesn't
Kept
- Pixel-for-pixel the PNG picture, because the WebP is lossless (VP8L)
- The true-color shed fill, the crosshatched walk and the PHANTOM property line
- Tree species attributes and wrapped MTEXT notes
- Plain RGB with no alpha channel, until
TransparentColorkeys a color out and adds one
Lost or not yet supported
- No lossy mode, so a smaller file at lower quality isn't possible.
ImageWidthandImageHeightare silently ignored on this route; the WebP is 2400 × 1600 regardless./v2/convert/webp/to/webpwithImageWidthresizes it.- Keying out the background leaves dark edges around antialiased lines, since only the exact background color is removed.
- Paper space, lineweights and the drawing's scale are not carried into the image.
Limits
- DXF versions R12 through 2018.
- One WebP per DXF, 2400 × 1600.
- Input that isn't DXF returns 422 with the parser's message.
- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- After 120 seconds a conversion returns 504.
Where teams use it
Lighter plan images on the web
Serve the WebP where a site would otherwise use the PNG: the same pixels in 7% fewer bytes for the garden plan, and browsers decode it natively.
Plans layered over maps or photos
Key out the background with TransparentColor=33,40,48 and place the plan over an aerial photo or a map tile in your viewer.
Questions
Why can't I set `ImageQuality`?
The WebP is written lossless, which has no quality setting. The API refuses values other than ConvertAPI's default of 75 rather than ignore them.
How do I make a smaller WebP?
Send ColorSpace=gray (57,094 bytes for the sample instead of 122,888), or resize the result with /v2/convert/webp/to/webp and ImageWidth.
Can browsers show the transparent version?
Yes, WebP supports alpha. With TransparentColor=33,40,48 the garden plan's white property line needs a dark backdrop to stay visible.
Convert your first DXF file in a minute.