Upscale images

Enlarge one image 2x or 4x, up to 4096x4096, for a flat price per effort. No model or prompt to choose.

Upscaling is in beta. The request shape is settled, but the models behind each effort may change as we see real traffic.

POST /image/upscale takes one image URL and returns it larger. There is no model field and no prompt. You pick a size and an effort, and Mynth picks the model.

import Mynth from "@mynthio/sdk";

const mynth = new Mynth();

const upscaled = await mynth.image.upscale({
  url: "https://cdn.example.com/product.jpg",
  size: "2x",
  effort: "low",
});

console.log(upscaled.image.url);

Fields

FieldNotes
urlRequired. A public http(s) image URL
sizeRequired. "2x" or "4x", or { "type": "scale", "factor": 2 } with 2 or 4
effortRequired. "low" or "high". It sets the price, so there is no default
output.formatpng, jpg, or webp. Omit it for the provider's format
destinationA destination name. See destinations
webhookPer-request URLs. See webhooks
metadataA JSON object up to 2048 bytes
access{ "pat": { "enabled": false } } skips the browser token

For a local file, pass file instead of url in the SDK, or a path in the CLI. Both upload it first. The CLI takes --size 2x or --size 4x only.

Pick an effort

effortGood forPrice
lowFast and sharp. Product shots, generated images, anything already clean$0.03
highRebuilds fine detail: small text, skin, fur, leaves, soft or damaged input$0.15

high can rebuild faces on old or damaged photos, which can change a person's likeness. Use low when the face must stay exactly as it is.

Size limit

The upscaled image can be at most 4096x4096 pixels (16.8 MP), counted in pixels rather than per side. That means:

  • 2x takes images up to about 4.2 MP, such as 2048x2048 or 1600x2600.
  • 4x takes images up to about 1 MP, such as 1024x1024 or 800x1300.

A larger request is accepted at create, then fails with OUTPUT_TOO_LARGE before any work starts. It is not charged.

The result comes back at whatever size the provider returns, which can be a few pixels off the source times the factor. Read size for the real dimensions.

What comes back

{
  "image": {
    "id": "img_Hn4cW8pLx2RsT6vYb0QjM9kE3dAf7ZuG",
    "url": "https://cdn.mynth.io/images/img_Hn4cW8pLx2RsT6vYb0QjM9kE3dAf7ZuG.png",
    "mynth_url": "https://cdn.mynth.io/images/img_Hn4cW8pLx2RsT6vYb0QjM9kE3dAf7ZuG.png",
    "size": "3072x4608",
    "format": "png"
  }
}

There is one image and no per-item status. If the work fails, the task is failed. With a destination, image also carries a destination block that says whether the upload worked. See destinations.

The create response includes a pat_ token, so a browser can poll this task the same way it polls a generation. See poll for results.

Price

$0.03 for low and $0.15 for high, per image, whatever the size. The price is held at create and charged when the task succeeds. See pricing.

Next steps