DXF to JPG API
Upload a DXF to /v2/convert/dxf/to/jpg and a 2400 × 1600 JPEG of model space comes back, drawn on a dark CAD background. The sample asks for ImageQuality=90; the default is 85.
- Endpoint
- POST /v2/
convert/ dxf/ to/ jpg - Accepts
- dxf
- Sample timing
- 0.153 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/jpg \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@linden-garden-site-plan.dxf \
--form-string ImageQuality=90 \
-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/jpg",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("linden-garden-site-plan.dxf", "rb"))],
data={
"ImageQuality": "90",
},
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);
form.append("ImageQuality", "90");
const url = "https://api.pdfconversionapi.com/v2/convert/dxf/to/jpg";
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.153,
"Files": [
{
"FileName": "linden-garden-site-plan.jpg",
"FileExt": "jpg",
"FileSize": 322681,
"FileData": "/9j/4AAQSkZJRgABAgAAAQAB…"
}
]
}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.jpg (315 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 |
|---|---|
ImageQualityinteger, default 85 | Compression quality of the JPEG. The garden plan is 322,681 bytes at 90 (the sample), 283,247 at 85 and 239,842 at 75, ConvertAPI's default.Values: 1–100 |
ColorSpaceenum, default default | gray gives a one-channel JPEG, 148,243 bytes for the sample. monochrome sets each pixel to black or white: the cyan notes, green beds and yellow dimensions stay white, while the red shed outline and the brown shed fill turn black like the background.Values: default, rgb, truecolors, gray, grayscale, monochrome |
ImageResolutioninteger | A DPI value written into the JPEG header, for programs that print or place the image. The pixel size doesn't change.Values: 10–800 |
FileNamestring | File name for the JPEG, without extension; linden-garden-site-plan by default. |
StoreFileboolean, default false | Return a 3-hour download link instead of the encoded JPEG. |
Not supported yet
Setting one of these to anything but its default returns 400.
| Option | What to do instead |
|---|---|
ImageWidth | Always 2400 pixels wide; resize the JPEG afterwards with /v2/convert/jpg/to/jpg. |
ImageHeight | Always 1600 pixels high. |
SpaceToConvert | Only model space; other values return 400. |
ExportLayers | false returns 400. |
Also refused when set: CustomSpaceToConvert.
What carries over, and what doesn't
Kept
- The drawing as a CAD screen shows it: colors, the white PHANTOM property line, hatches, attributes and dimensions on the dark background
- Exact true colors before compression: the shed fill is RGB 139, 90, 43 in the PNG this JPEG is encoded from
- Color detail in thin lines: no chroma subsampling (4:4:4), so the green bed outlines and cyan text don't bleed
- Hidden layers stay hidden: the off survey layer and the frozen old-shed layer are not drawn
Lost or not yet supported
- JPEG is large for line drawings. The sample is 322,681 bytes, 2.4 times the 132,185-byte PNG of the same picture, and edges of thin lines pick up compression noise.
- The size is always 2400 × 1600, with the plan fitted inside, so the image has no scale.
- The background can't be changed:
BackgroundColorandAlphaColorare accepted and have no effect, because the picture has no transparency. - Lineweights and paper space are not drawn, and SHX-style text uses a single-stroke font.
Limits
- DXF versions R12 through 2018.
- One JPEG per DXF.
ImageQualitymust be 1 to 100 andImageResolution10 to 800; other values return 400.- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- Each conversion is allowed 120 seconds, then the API answers 504.
Where teams use it
Plans in emails and printed handouts
A garden committee, a landscaper or a homeowner can open a JPEG anywhere. Attach the site plan to an email or drop it into a newsletter without asking anyone to install a DXF viewer.
Pictures for systems that want JPEG
Listing sites, form builders and older document systems often accept JPEG uploads only. Convert the DXF on the way in and store the original next to the picture.
Questions
What JPEG quality should I use?
For drawings, higher than for photos: thin lines show compression noise quickly. The sample uses 90. At ConvertAPI's default of 75 the file is 239,842 bytes. If size matters, PNG (132,185 bytes) and WebP (122,888) are smaller and lossless.
How do I get a black-and-white image?
Send ColorSpace=monochrome. You get white lines on black, and only colors brighter than mid-gray survive: in the garden plan the red shed outline and the brown fill disappear. For print, a PDF from /v2/convert/dxf/to/pdf is black on white instead.
Does `ImageResolution` make the drawing sharper?
No. It only records a DPI value in the file. The drawing is always drawn into 2400 × 1600 pixels.
Convert your first DXF file in a minute.