WebP to ICO API
POST a WebP to /v2/convert/webp/to/ico and get an icon file with one 32-bit image of up to 256 × 256, stored as PNG. Transparency from the WebP is kept, including anti-aliased edges; ImageWidth picks the icon size.
- Endpoint
- POST /v2/
convert/ webp/ to/ ico - Accepts
- webp
- Sample timing
- 4 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/webp/to/ico \
-H "Authorization: Bearer $PDFCONVERSIONAPI_KEY" \
-F File=@guest-badge.webp \
--form-string ImageWidth=128 \
-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/webp/to/ico",
headers={"Authorization": f"Bearer {key}"},
files=[("File", open("guest-badge.webp", "rb"))],
data={
"ImageWidth": "128",
},
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 = "guest-badge.webp";
form.append("File", new Blob([await readFile(file)]), file);
form.append("ImageWidth", "128");
const url = "https://api.pdfconversionapi.com/v2/convert/webp/to/ico";
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.004,
"Files": [
{
"FileName": "guest-badge.ico",
"FileExt": "ico",
"FileSize": 15255,
"FileData": "AAABAAEAgFMAAAAAIACBOwAA…"
}
]
}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
- guest-badge.webp (9.4 KB)
- Output
- guest-badge.ico (15 KB)
- Source
- A guest pass for a made-up trade show that we drew for this page, saved as a lossy WebP with a transparent background and a soft shadow. (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 | Icon width. The sample asks for 128 and gets 128 × 83; 32 gave 32 × 21 in 1,526 bytes. Anything above 256 is capped.Values: 1–20000 |
ImageHeightinteger | Icon height; together with ImageWidth the badge is fitted inside the box, so 64 × 64 gave 64 × 42.Values: 1–20000 |
ScaleProportionsboolean, default true | false with a 64 × 64 box made a square, squashed 64 × 64 icon. |
ScaleIfLargerboolean, default false | true skips enlarging WebPs that are already smaller than the box. |
ScaleImageboolean, default true | false with 64 × 64 cut the badge's top-left corner out at full scale instead of shrinking it. |
ColorSpaceenum, default default | gray gave a 38,492-byte gray icon at 256 px, alpha kept. monochrome leaves only black and white even after the fit, also with the alpha kept (6,213 bytes at 256 px). cmyk returns 400.Values: default, rgb, gray, monochrome |
FileNamestring | Name for the .ico; guest-badge.ico unless set. |
StoreFileboolean, default false | true makes the API store the icon for 3 hours and answer with its URL. |
What carries over, and what doesn't
Kept
- Transparency, partial included: the 128 × 83 icon has 253 fully clear pixels and 1,768 partly clear ones along the rounded corners and shadow.
- Color depth: 32 bits per pixel, stored as a PNG inside the ICO (15,233 of 15,255 bytes).
- The badge's proportions when you set one side: 400 × 260 became 128 × 83.
- The heading and GUEST PASS lettering, still readable at 128 px wide.
- EXIF orientation: a 300 × 200 WebP tagged 6 was stood upright before fitting, giving a 171 × 256 icon.
Lost or not yet supported
- Small detail: the QR code no longer decoded at 128 × 83.
- Sizes above 256 pixels: with no options the icon is 256 × 166.
- Every size but one, and every frame but the first of an animated WebP.
- EXIF, XMP and ICC data from the WebP.
Limits
- One WebP per request; one image per .ico, at most 256 × 256.
- Requests up to 10 MB on the Free plan or 100 MB on paid plans, all files and fields together.
- The WebP may have up to 100,000,000 pixels; above that the answer is 413.
- 120 seconds per conversion, then 504.
Where teams use it
App and shortcut icons from web artwork
Logos and badges published as transparent WebP can become .ico files for a Windows shortcut, an installer or a desktop app, with clean edges on any background.
Favicons in one request per size
Request 16, 32 and 48 pixel versions one by one with ImageWidth. Each .ico holds one image, so combine them yourself if you need a multi-size file.
Questions
Does the icon keep the WebP's transparency?
Yes, partial alpha included. The 128 × 83 sample icon has 253 clear pixels and 1,768 partly clear ones, with alpha from 1 to 254 after scaling.
What size is the icon if I don't set one?
The WebP is fitted inside 256 × 256 with its proportions kept. The 400 × 260 badge became 256 × 166 (42,864 bytes).
Can one .ico contain 16, 32 and 48 pixel versions?
No. Each response holds a single image, so make one request per size with ImageWidth.
Can I make a square icon from a wide image?
Set ImageWidth and ImageHeight to the same value with ScaleProportions=false to stretch it, or with ScaleImage=false to crop the top-left square. Fitted normally, a 64 × 64 box gives 64 × 42.
Convert your first WebP file in a minute.