Skip to content
pdfconversionapi

DWG to WebP API

POST a DWG to /v2/convert/dwg/to/webp and receive a lossless WebP of model space, 2400 × 1600, on the same dark background as the PNG route. For the sample deck plan it is 85,052 bytes, against 97,617 for the PNG.

Endpoint
POST /v2/convert/dwg/to/webp
Accepts
dwg
Sample timing
0.104 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/dwg/to/webp \
  -H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
  -F File=@deck-framing-plan.dwg \
  -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 OK0.104 s median1 file, 83 KB
{
  "ConversionCost": 1,
  "ConversionTime": 0.104,
  "Files": [
    {
      "FileName": "deck-framing-plan.webp",
      "FileExt": "webp",
      "FileSize": 85052,
      "FileData": "UklGRjRMAQBXRUJQVlA4TCdM…"
    }
  ]
}

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 deck-framing-plan.webp, rendered by the API
Input
deck-framing-plan.dwg (12 KB)
Output
deck-framing-plan.webp (83 KB)
Source
A framing plan for a fictional 16 by 12 foot backyard deck, which we drew as a DXF with a short script and saved as DWG (2004 format) (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
TransparentColorstringMakes one exact color transparent. Send the background color, 33,40,48 or #212830, and only the linework stays opaque: 91,678 bytes for the sample.Values: A color name, #RRGGBB or R,G,B
ColorSpaceenum, default defaultgray or monochrome change the pixels, but a WebP can't hold a gray-only image, so the file is still RGB: gray shrinks the sample to 45,314 bytes and monochrome to 14,218. cmyk returns 400.Values: default, rgb, truecolors, gray, grayscale, monochrome
ImageResolutionintegerChecked (10–800) and accepted, but WebP has no field for it, so the file doesn't change.Values: 10–800
FileNamestringOutput name without .webp; otherwise the DWG's name is used.
StoreFileboolean, default falseGet a link to the stored WebP, good for 3 hours, instead of the bytes.

Not supported yet

Setting one of these to anything but its default returns 400.

OptionWhat to do instead
ImageQualityThe WebP is always lossless. Only 75, ConvertAPI's default, is accepted, and it doesn't change the file.
ImageAntialiasingOnly the default, 8, is accepted.
SpaceToConvertModel space only; non-default values return 400.
ExportLayersfalse returns 400.

Also refused when set: CustomSpaceToConvert.

What carries over, and what doesn't

Kept

  • Every pixel of the CAD-screen picture: the WebP is lossless (VP8L), so it decodes to the same image as the PNG
  • Layer colors and white color-7 lines on the dark background
  • Transparency only on request: the default file is RGB with no alpha channel, and TransparentColor adds one
  • Dashed HIDDEN lines, hatching, block inserts with attributes, and the off S-DECKING layer left out as in the file

Lost or not yet supported

  • No lossy setting: ImageQuality other than 75 returns 400, so you can't trade quality for a smaller file.
  • ImageWidth and ImageHeight are ignored without an error on this route, and the WebP is still 2400 × 1600. Resize with /v2/convert/webp/to/webp if you need another size.
  • With TransparentColor, antialiased line edges keep a dark fringe, because only pixels of exactly the background color become transparent.
  • No drawing scale, no DPI, and nothing from paper-space layouts.

Limits

  • DWG files saved in the R13 through 2018 formats.
  • One 2400 × 1600 WebP per DWG.
  • A damaged DWG returns 422 with the reader's message.
  • Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
  • 120 seconds per conversion, then 504.

Where teams use it

Lighter previews on a web page

Serve the WebP instead of the PNG in a drawing viewer or a project portal. It is the same pixels, 13% smaller for the sample, and every current browser displays WebP.

Overlays with a transparent background

With TransparentColor=33,40,48 the drawing's lines float over whatever is behind them, for example a site photo or a map tile. Pick a dark backdrop if the drawing has white color-7 lines.

Questions

Is the WebP lossy or lossless?

Lossless. The file uses the VP8L format, so its pixels match the PNG route exactly; that is also why ImageQuality can't be changed.

How do I get a transparent background?

Send TransparentColor=33,40,48 (or #212830). In the sample, 3,742,112 background pixels become transparent and the lines stay. White color-7 lines then need a dark page behind them to be seen.

Why doesn't `ImageWidth` change anything?

ConvertAPI documents no size options for DWG to WebP, and the API ignores options that aren't documented for a pair, so the request succeeds at 2400 × 1600. On dwg/to/png and dwg/to/jpg the same option returns 400 instead.

Convert your first DWG file in a minute.