convert_format · 1 credit · 6 output formats

Image format converter API — PNG, JPG, WebP, GIF, TIFF and AVIF

Send an image and a target format, get a hosted URL back for 1 credit. The file is genuinely re-encoded server-side rather than renamed, and the whole request is two fields. It is callable over REST from your backend, or as the convert_format tool from any AI agent that speaks MCP.

Six formats is fewer than the two-hundred-format file-conversion services will offer you, and there is no quality dial. What you get instead is a published account of exactly what the encoder does to your image — the part those services leave out.

By the imagemcpserver.com teamPublished Updated
PNGJPGWEBPGIFTIFFAVIFany of them

What it converts, and what it does not

Somebody sends a TIFF. The CMS wants WebP. The partner integration insists on JPEG. Format conversion is the least interesting problem in an image pipeline and the one most likely to stop it — so it is a single call here rather than a build step.

It reads JPEG, PNG, WebP, TIFF, GIF, AVIF and SVG, and writes PNG, JPEG/JPG, WebP, GIF, TIFF and AVIF. That is the whole surface. HEIC from an iPhone is not supported, and neither are BMP, PSD, camera RAW or PDF — this is a raster web-format converter, not a document converter. If you need to pull pages out of a PDF or read a Photoshop file, a general file-conversion service is the right tool and we would rather say so.

The trade you are making

There are no knobs — no quality percentage, no resize, no colour-space choice. Every encoder setting is fixed at its default, and the next section lists what those defaults actually are. When you need the quality dial instead, the call you want is compress_image.

Does converting lose quality?

Usually yes — five of the six targets are lossy. This is the question people actually ask about conversion, and most conversion APIs answer it by listing the knobs they expose rather than the settings they use. Since this endpoint exposes none, here are the settings, measured against the encoder build it runs rather than quoted from documentation.

Encoder behaviour by target format: whether the conversion is lossy, the fixed encoder setting used, and what happens to the alpha channel.
TargetLossy?Fixed settingTransparencyNotes
PNGLosslesscompression level 6KeptThe only target that returns identical pixels. Re-encoding a PNG as PNG gives back the same bytes.
WebPLossyquality 80KeptThe default answer for the web. Lossless WebP exists in the encoder but is not exposed here.
AVIFLossyquality 50KeptSmallest files of the group, and the most aggressive default. Slower to encode than the rest.
JPEG / JPGLossyquality 80Flattened to blackMaximum compatibility. Both jpeg and jpg are accepted and produce the same file.
TIFFLossyJPEG compression, quality 80Flattened to blackNot the archival TIFF you are expecting — the default compression is JPEG, so the pixels change.
GIFLossy256-colour palette1-bit onlyColour is quantised by the format itself. Animation is not carried across.

The TIFF surprise

People reach for TIFF because it means “lossless master”. Here it does not. The encoder’s default TIFF compression is JPEG, so a TIFF conversion produces exactly the same pixel error as asking for a JPEG — and drops the alpha channel too. If you need a real archival master, keep the PNG.

Convert once, not repeatedly

Lossy re-encodes compound. Converting WebP to JPEG to WebP again puts the image through two rounds of quality-80 loss and there is no way to get it back. Keep one lossless source and convert outward from it each time, rather than chaining conversions on top of each other.

Transparency, and where it goes

PNG, WebP and AVIF all carry a full alpha channel, so a cutout converted between any of them comes out unchanged. GIF carries a single transparent colour rather than a channel, so soft anti-aliased edges turn jagged.

JPEG and TIFF have no alpha in this pipeline at all, and this is the part worth reading twice: the transparent areas are not made white, they are made solid black. Convert a product cutout to JPEG expecting a clean white background and you will get a silhouette on a black rectangle instead. Nothing errors and nothing warns you — the call succeeds and bills normally.

If you need a cutout on a specific background colour, composite it yourself before converting, or keep it as PNG or WebP and let the page background show through.

Making the cutout in the first place →

Cutout PNG, converted

→ pngalpha kept
→ webpalpha kept
→ avifalpha kept
→ gif1-bit only
→ jpegflattened to black
→ tiffflattened to black

Know this before you send a GIF

Animation does not survive a conversion

An animated GIF sent to this endpoint comes back as a single still frame. Not a shorter animation, not a lower-quality one — the first frame, alone. That is true for every target, including GIF to GIF, and it happens because the converter reads the image as a single page.

The request still succeeds, still returns a normal-looking URL and still costs a credit, so the only way to notice is to look at the result. If the animation matters, convert it outside the platform with a tool that handles multi-frame images. We would rather tell you that here than have you find it in production.

in — animated.gif4 frames
out — converted.webp1 frame

EXIF, colour profiles and rotation

A conversion returns pixels and nothing else. EXIF, the embedded ICC colour profile and the orientation tag are all discarded.

For user-uploaded content that is mostly a benefit: GPS coordinates, camera serial numbers and timestamps go with it, so converting doubles as a scrub. For photographs straight off a phone it is a hazard. Phone cameras often store the sensor image sideways and add an orientation tag telling the viewer to rotate it. Drop the tag and the pixels do not move — so a photo that looked upright everywhere else arrives in your pipeline rotated ninety degrees.

If your input is phone photography, apply the rotation before you convert. Losing the ICC profile matters far less in practice, since almost everything on the web is sRGB already, but it is worth knowing if you handle print assets in a wider gamut.

One direction only

You cannot convert a photo into an SVG

It is the most common request this endpoint refuses, and the refusal is deliberate rather than a missing feature. A raster image is a grid of coloured pixels; an SVG is a list of shapes. There is no path from the first to the second, and the tracing tools that pretend otherwise return thousands of overlapping polygons — larger than the original, impossible to edit, and wrong at every size. Ask for svg and you get a 400 that says so, before any credit is deducted.

The other direction works fine, and it is genuinely useful: SVG is a valid input. Vector artwork rasterises cleanly to PNG or WebP at whatever size the source declares, which is exactly what you need after generating a logo with text_to_svg and discovering that the destination only accepts bitmaps.

Generate an actual SVG
svg → png
tiff → jpeg
png → webp
jpg → avif
jpg → svg

The request

The source image and the target format. That is the whole API. The image can be a public URL, a data URI or bare base64 — which means you can hand it a URL that another tool returned a moment earlier without downloading anything yourself.

Failures refund automatically. If the source cannot be fetched or decoded, the response is a 500 with refundedCredits set, and an unsupported target format is rejected with a 400 before any credit is taken at all.

Converting a whole folder

Conversions do not depend on each other, so they are a perfect fit for multicall. Fifty images convert concurrently for fifty credits and one round trip, billed as a single deduction.

POST /v1/convert-format
curl -X POST "https://api.imagemcpserver.com/v1/convert-format" \
  -H "Authorization: Bearer $IMAGEMCP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://cdn.example.com/scan.tiff",
    "targetFormat": "webp"
  }'

Python and Node

Both samples read the size change out of the response, and both are explicit about the alpha channel — because that is the failure you will not see until someone looks at the image.

Python
import os, requests

r = requests.post(
    "https://api.imagemcpserver.com/v1/convert-format",
    headers={"Authorization": f"Bearer {os.environ['IMAGEMCP_API_KEY']}"},
    json={"image": src_url, "targetFormat": "webp"},
    timeout=60,
)
r.raise_for_status()
result = r.json()["result"]

# Transparency is gone the moment you target jpeg or tiff — check before you commit.
if result["targetFormat"] in ("JPEG", "TIFF"):
    print("warning: any alpha in the source is now solid black")

print(result["originalFormat"], "->", result["targetFormat"])
print(result["originalSize"], "->", result["convertedSize"])
print(result["imageUrl"])
Node
const res = await fetch("https://api.imagemcpserver.com/v1/convert-format", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.IMAGEMCP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ image: srcUrl, targetFormat: "webp" }),
});

const body = await res.json();
if (!body.success) throw new Error(body.message); // credits are refunded on failure

const { result } = body;
console.log(`${result.originalFormat} -> ${result.targetFormat}`);
console.log(`${result.originalSize} -> ${result.convertedSize}`);
console.log(result.imageUrl);

Every field

Three fields, one of them required. There is nothing hidden behind a feature flag.

Request body fields accepted by POST /v1/convert-format.
FieldTypeWhat it does
imagestring · requiredA public https URL, a data URI, or bare base64 — including a URL another tool just returned. imageBase64 is accepted as an alias.
targetFormatpng · jpeg · jpg · webp · gif · tiff · avifThe output format. Defaults to png over REST; the MCP tool requires it explicitly. Anything outside the set returns a 400 and is not billed. svg returns its own 400 pointing you at text_to_svg.
responseFormaturl · b64_jsonDefaults to url. Unlike some endpoints here this one is genuinely wired up: ask for b64_json and you get b64_json and imageBase64 alongside the hosted imageUrl, which is still returned either way.

What comes back

The converted file is hosted for you and returned as result.imageUrl — a real https URL, not a data URI. That is the opposite of compression, which hands back base64 and hosts nothing.

Alongside it you get the detected input format, the dimensions, and the before and after sizes in KB — enough to log the saving without measuring anything yourself. Credit fields are deductedCredits and userCredits, returned both at the top level and inside result.

200 OK
{
  "success": true,
  "message": "Image converted to WEBP successfully",
  "deductedCredits": 1,
  "userCredits": 2417,
  "result": {
    "imageUrl": "https://cdn.imagemcpserver.com/convert/convert_4471928.webp",
    "originalFormat": "TIFF",
    "targetFormat": "WEBP",
    "mimeType": "image/webp",
    "width": 1536,
    "height": 1024,
    "originalSize": "4184.6 KB",
    "convertedSize": "196.3 KB",
    "latency": "0.38s",
    "cost": "$0.0000",
    "deductedCredits": 1,
    "userCredits": 2417
  }
}

Choosing a target format

Converting is easy. Converting to the right thing is the part that saves you a second pass later — usually after someone notices the transparency is gone.

WebP

Almost everything you serve to a browser — photographs, illustration and cutouts alike.

One format covers both jobs, alpha survives, and support is universal in current browsers.

AVIF

Large hero images where the bytes genuinely matter and you can afford a slower encode.

The smallest files here, though the quality-50 default is more aggressive than the others.

PNG

Cutouts you will edit again, screenshots, UI assets, flat colour and hard edges.

The only lossless target. Reach for it when the pixels have to stay exact.

JPEG

A partner system, a legacy CMS, or anything that predates WebP.

Compatibility, at the cost of the alpha channel. Never send a cutout here.

GIF

A downstream tool that accepts nothing else.

Rarely the right answer now that WebP exists, and the animation will not survive anyway.

TIFF

A print or archival hand-off that demands the extension.

Read the note above first — the output is JPEG-compressed, so it is not a lossless master.

What it costs

One credit per call, flat. Not per megabyte, not per format, not scaled by resolution — a 40 KB icon and a 40 MB scan cost exactly the same. Depending on your plan that is roughly 1.25 to 2 cents, and it is the joint-cheapest call on the platform alongside compression.

It is cheap because no model provider is involved. Conversion runs on ordinary encoding infrastructure, which is also why it usually finishes in well under a second while a generation call is measured in seconds.

Full pricing →

Cost of a conversion

1credit

  • Same price for every source and target format
  • Same price whatever the file size
  • Rejected formats are validated first and cost nothing
  • Failed conversions refund automatically

Format conversion questions

How do I convert PNG to WebP without losing quality?

Not through this endpoint. WebP output here is written at the encoder default of quality 80, which is lossy, and there is no lossless flag to set. The only target format that comes back pixel-identical is PNG. If a file has to survive byte-for-byte, run a lossless WebP encoder yourself — for everything headed to a browser, quality 80 is the setting most pipelines would have picked anyway.

Is it safe to convert PNG to WebP?

For photographs, illustration and UI art on the web, yes — the alpha channel survives intact and the file gets much smaller. It is not safe when the PNG is a master copy you will edit again, because each lossy round trip compounds. Convert on the way out to the browser, keep the PNG as the source of truth.

Does converting reduce image quality?

It depends entirely on the target. PNG is lossless. WebP and JPEG are written at quality 80, AVIF at quality 50, and GIF is squeezed into a 256-colour palette — all lossy. TIFF is the surprising one: it is JPEG-compressed by default, so an archival format comes back lossy. The table on this page lists every default.

Is WebP better quality than PNG?

Not at equal settings — PNG is lossless and WebP as used here is not. WebP is better value: at quality 80 the difference is invisible in normal viewing while the file is a fraction of the size. Choose PNG when pixels must be exact, WebP when bytes on the wire matter.

What happens to transparency when I convert?

PNG, WebP and AVIF keep the alpha channel exactly as it was. GIF keeps only single-bit transparency, so soft edges go jagged. JPEG and TIFF have no alpha in this pipeline at all — the transparent areas are flattened to solid black, not white, which is the single most common surprise with this endpoint.

Does an animated GIF stay animated?

No. Every conversion reads the first frame only, so an animated GIF comes back as a single still image — including GIF to GIF. If you need the animation, this endpoint is the wrong tool and you should convert it outside the platform.

Can I convert a photo to SVG?

No, and no honest tool can. A photograph is a grid of pixels with no shapes to recover; auto-tracing invents thousands of meaningless polygons that end up larger than the original and impossible to edit. Asking for svg returns a 400 and costs nothing. Conversion the other way does work — an SVG is a valid input, so you can rasterise vector artwork to PNG or WebP.

Which input formats are accepted?

JPEG, PNG, WebP, TIFF, GIF, AVIF and SVG. HEIC from an iPhone is not supported, and neither are BMP, PSD, camera RAW or PDF. This is a raster web-format converter, not a document converter — if you need those, a general file-conversion service is the better fit.

Is EXIF data preserved?

No. EXIF, the ICC colour profile and the orientation tag are all dropped. That is a privacy win for user uploads, since GPS coordinates go with them, but it means a phone photo that relied on its orientation tag to display upright will come back rotated. Fix rotation before you convert.

How much does a conversion cost?

One credit per call, flat, whatever the source and target formats and whatever the file size — roughly 1.25 to 2 cents depending on your plan. No model provider is involved, so it is among the cheapest and fastest calls on the platform. A rejected format costs nothing, because the target is validated before any credit is deducted.

How is this different from compress_image?

convert_format changes the container and gives you a hosted URL, with the encoder settings fixed. compress_image is about file size: you pick a quality from 1 to 100 and it hands the bytes straight back as base64, with no hosted copy. Convert when the format is wrong, compress when the file is too heavy.

Can I convert a whole batch at once?

Yes. Conversions are independent of one another, so they are a natural fit for multicall — the requests are dispatched concurrently, billed at 1 credit each in a single deduction, and returned in the order you sent them.

Reference

The encoder defaults on this page were established by running the endpoint’s own conversion call and comparing each result byte-for-byte against an explicitly configured encode, rather than by quoting documentation. Re-checked 8 September 2026 against the deployed build.

Keep reading