waifu2x

WAIFU2X

Enlarges illustrations, anime and photos 2 or 4 times and can remove JPEG noise as it does. Three styles: art, photo, and art_scan for scanned drawings and manga.

Image Editingsuper-resolutionupscalinganimeillustrationjpeg-artefactsmitFine-tunable
waifu2x: Image Editing model on Kainguru

About waifu2x

Capabilities

  • 2x or 4x — choose the scale for each request
  • Three styles — art for illustrations and anime, photo for photographs, art_scan for scanned drawings and manga
  • Noise removal — four strengths of JPEG artefact removal done while it enlarges, or none
  • Fine-tunable — train any style, scale and noise level on your own pairs of small and large pictures

Good to know

  • Pictures are PNG, JPEG or WebP, at most 50 MB and at least 16 pixels a side. The result may have at most 16.8 megapixels: up to 2048 x 2048 in at 2x, 1024 x 1024 at 4x.
  • Large pictures are enlarged in overlapping tiles that are blended where they meet, so every size up to the limit works the same way. Transparency is dropped.
  • Noise level -1 only enlarges; 0 to 3 also remove JPEG noise, 3 the most. Photo and art_scan have no 2x network of their own: their 2x is the 4x result scaled down, which is slower than art's.
  • Fine-tuning takes one ZIP (at most 4 GB, no password) with 4 to 1000 pairs and a manifest.jsonl holding one {"input": "...", "target": "..."} line per pair, paths relative to the manifest. Each target is exactly scale times its input's width and height; inputs are at least 64 pixels a side. A fine-tune trains one style, scale and noise level, the ones named in its parameters, and the fine-tuned model enlarges at those.
  • Training stops after the steps you ask for or after 9 hours, whichever comes first, and keeps what it has learned.

waifu2x inputs and output

NameTypeRequiredDefaultDetails
imagefileYes—The picture to enlarge: PNG, JPEG or WebP, at most 50 MB and 16 pixels a side or more. The result may have at most 16.8 megapixels: at 4x, 1024 x 1024 in.
1–2048 characters · image/png, jpeg, webp
noise_levelintegerNo-1JPEG noise removal while enlarging: -1 leaves the picture's noise as it is, 0 removes a little, 3 the most.
Allowed: -1, 0, 1, 2, 3 · -1–3
scaleintegerNo4How many times wider and taller the result is.
Allowed: 2, 4 · 2–4
styletextNoartart: illustrations and anime. photo: photographs. art_scan: scanned drawings and manga.
Allowed: art, photo, art_scan

Output. Returns PNG image: The enlarged picture as a PNG, scale times the width and height of the input.

Run waifu2x with the API

Send your API key in the X-API-Key header. The run is asynchronous: submit it, then poll it until it finishes. Create an API key.

cURL
curl -X POST "https://api.kainguru.com/api/v1/executions?mlFlowId=WAIFU2X" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "noise_level": -1,
    "scale": 4,
    "style": "art"
  },
  "outputFormat": "json"
}'

# Poll until the execution reaches a terminal state
curl "https://api.kainguru.com/api/v1/executions/{executionId}" \
  -H "X-API-Key: kg_your_api_key"
Python
from kainguru import KainguruClient

with KainguruClient(api_key="kg_your_api_key", base_url="https://api.kainguru.com/api") as client:
    submitted = client.executions.execute(
        "WAIFU2X",
        {
          "image": "https://example.com/input.png",
          "noise_level": -1,
          "scale": 4,
          "style": "art"
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Fine-tune waifu2x

You can fine-tune waifu2x on your own data and run the tuned model through the same API. Dataset: One ZIP (at most 4 GB, no password) with 4 to 1000 pairs of a low-resolution picture and the same picture exactly scale times larger, and manifest.jsonl with one {"input", "target"} line per pair. More: Good to know, in the README.

The steps are in the docs.

waifu2x pricing

Price per image: 0.0874 credits ($0.000874). The price is shown again before every run; all prices are on the pricing page.

Licence and source

Swin2SR: Image Editing model on Kainguru
Image Editing

Swin2SR

Enlarges a JPEG-compressed photo 4 times in width and height and removes its blocky compression artefacts as it does.

Fine-tunable
LDSR: Image Editing model on Kainguru
Image Editing

LDSR

Enlarges a small picture 4 times with latent diffusion, drawing in new plausible detail. A creative upscale: richer…

Fine-tunable
SwinIR: Image Editing model on Kainguru
Image Editing

SwinIR

Enlarges real-world photos 2 or 4 times in width and height and cleans up the blur, noise and compression they carry.

Fine-tunable
DeOldify: Image Editing model on Kainguru
Image Editing

DeOldify

Colourises old black-and-white photos in two styles: artistic, with bolder colours, or stable, calmer and more…

Fine-tunable
HVI-CIDNet: Image Editing model on Kainguru
Image Editing

HVI-CIDNet

Brightens dark and low-light photos and restores their colour, lifting the shadows without washing out the highlights…

Fine-tunable
InstructIR: Image Editing model on Kainguru
Image Editing

InstructIR

Restores a photo by following a sentence in plain English, such as remove the noise, take the rain out, fix the blur…

Fine-tunable