Recraft V4 on Sume returns WebP only: convert to PNG or JPEG in Python

Recraft V4 on Sume outputs WebP and takes no references. A Pillow converter for PNG or JPEG, with transparency flattened onto white for JPEG delivery.

5 min readSume
All posts

Recraft V4 on Sume hands back WebP and nothing else, so if your next tool wants PNG or JPEG you convert the file yourself. Sume's catalog lists Recraft V4 as text-to-image with WebP output and no input references, which means you cannot ask for a different format and you cannot feed it a photo to edit.

That is a real difference from the FLUX 3 Image launch this week, where BFL describes editing with up to ten reference images. If you want to compare a design-leaning model with an editing-leaning one on the same brief, expect to do the format step yourself for one side. The converter below is the whole job.

What is and is not allowed

Sume's Image API rejects parameters a model does not list: send output_format or input_references to a row that lacks them and you get 400 unsupported_parameter. The safe habit is to read the model's supported_parameters from GET /v1/images/models and branch on it, not to hard-code per-model assumptions.

read 2026-10-03 from Sume's image model docs
NeedRecraft V4 on SumeWhat to do
Output formatWebP onlyConvert after download
Input referencesNot acceptedUse an edit model for photo work
Transparent PNGConvert keeps alpha if the WebP has itCheck the alpha band after converting
JPEG for a marketplaceConvertFlatten onto white, then save at quality 92

The converter

The function downloads the result, opens it with Pillow, and writes PNG or JPEG. For JPEG it flattens any transparency onto a background color first, because JPEG has no alpha channel and a naive save either fails or leaves a black fringe. Download promptly: Sume's docs describe result URLs as Sume-hosted and signed, so save the file instead of treating the link as permanent storage.

import io
import requests
from PIL import Image

def webp_to(url, out_path, fmt="PNG", background=(255, 255, 255)):
    """Download a WebP result and save it as PNG or JPEG."""
    raw = requests.get(url, timeout=60)
    raw.raise_for_status()
    im = Image.open(io.BytesIO(raw.content))
    if fmt.upper() == "JPEG":
        if im.mode in ("RGBA", "LA"):
            flat = Image.new("RGB", im.size, background)
            flat.paste(im, mask=im.getchannel("A"))
            im = flat
        else:
            im = im.convert("RGB")
        im.save(out_path, "JPEG", quality=92)
    else:
        im.save(out_path, "PNG")
    return im.size

Details that bite

Pillow reads WebP through libwebp, which ships with current wheels; if Image.open raises on a WebP, upgrade Pillow before you suspect the file. Convert once and keep the PNG as your master. Re-saving JPEGs repeatedly loses detail each time, as the PNG versus JPEG passes post measures.

If the destination is a social platform with its own format rules, such as TikTok photo posts, check those rules before choosing between PNG and JPEG.

A batch version

Real jobs rarely convert one file. Wrap the function in a loop over the result URLs from a batch request, name each output after the prompt id you track in your own system, and write PNG masters into one folder and JPEG deliverables into another. Keep the conversion separate from the generation call: if a download fails you can retry it without paying for a second image.

Two small checks make the loop safe. Compare the converted size to the size you asked for, since a silent resize would mean a different output than you expect. And open one JPEG per batch with your eyes, because a flattened transparent logo on a white background is the most common surprise when the brand color was supposed to show through.

Where WebP is actually fine

Do not convert out of habit. WebP is smaller than PNG for most graphics and every current browser displays it, so a web page can use the Recraft file as it comes. Convert only when a downstream tool, a marketplace upload form or an email client refuses it. If you do convert, record that the PNG came from a WebP in your own asset notes, so no one later mistakes it for a lossless original: a PNG made from a lossy WebP is still carrying the WebP's compression.

When to pick another model

If you need PNG straight from the API, GPT Image 2.5 lists PNG, WebP and JPEG as output formats. For logos and flat graphics Recraft is still a reasonable choice; the catalog is the source of truth at docs.sume.com/models/images. FLUX 3 is not on Sume's list; the docs show FLUX.2 pro and flex.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume