Kandinsky 2 2 Img2img

KANDINSKY_2_2_IMG2IMG

Kandinsky 2.2 restyles a photo from a text prompt and keeps its layout; the strength sets how far the result moves from the original.

Image Editingimage-to-imagerestylekandinskyapache-2.0
Kandinsky 2 2 Img2img: Image Editing model on Kainguru

About Kandinsky 2 2 Img2img

Restyles a photo from a text prompt and keeps the photo's layout. Kandinsky 2.2 is a two-stage model: a prior maps the prompt into an image embedding, and a decoder repaints the photo's latents toward that embedding. How far the result moves from the original photo is the strength.

The weights are kandinsky-community/kandinsky-2-2-decoder at revision 9ae140d347fed8ce6e8bb3005dcc1f48543bb8e3 and kandinsky-community/kandinsky-2-2-prior at revision 9fc51ad5732afc5d031724219d22e6c42179c5a8. Both cards state the licence as Apache-2.0. The model was created by Arseniy Shakhmatov, Anton Razzhigaev, Aleksandr Nikolich, Igor Pavlov, Andrey Kuznetsov and Denis Dimitrov (kandinsky-community).

Generation settings

Taken from the text-guided image-to-image example on both pinned cards:

pipe = AutoPipelineForImage2Image.from_pretrained("kandinsky-community/kandinsky-2-2-decoder", torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()

prompt = "A fantasy landscape, Cinematic lighting"
negative_prompt = "low quality, bad quality"

image = pipe(prompt=prompt, image=original_image, strength=0.3, height=768, width=768).images[0]

This project loads the same weights as KandinskyV22PriorPipeline and KandinskyV22Img2ImgPipeline in float16 and turns on model CPU offload, as the card's example does: each network moves to the GPU only while it runs.

  • Negative prompt low quality, bad quality, from that example.
  • Strength 0.15. The example uses 0.3, but with this decoder 0.3 already repaints the whole photo from the prompt; up to about 0.2 keeps the photo's layout.
  • Resolution in the example is 768×768 after the sample sketch is resized to 768×512. Here the photo keeps its aspect ratio. The long side is at most 1024 pixels and both sides are multiples of 64, which matches the sizes the card says the model was trained to draw (512 up to 1024 and beyond).
  • Steps 50. The image-to-image example does not pass num_inference_steps. The decoder's library default is 100, and the prior card's ControlNet image-to-image example uses 50. This slice accepts at most 50, so 50 is the default.
  • Guidance 4.0. The image-to-image example does not pass guidance_scale or prior_guidance_scale. 4.0 is the library default those arguments would keep. The text-to-image example on the same card sets prior_guidance_scale=1.0 for a different task. That value is not used here. The number you pass is sent to both the prior and the decoder.

The same photo, prompt, negative prompt, strength, steps, guidance and seed produce the same image. Seed -1 draws a seed in 0 … 2147483647 and prints it as [kandinsky-2-2-img2img] seed=....

Hardware

Runs on an NVIDIA A100 slice of class mig2g: 20 GB of GPU memory and 24 GiB of RAM. Prior and decoder weights load in float16 with model CPU offload, so they wait in RAM (about 10 GB, which is why the 12 GiB mig1g class is too small) and only the network that is running sits on the GPU. A 1024-pixel image at 50 decoder steps usually finishes in well under a minute on that slice. Fewer steps, or a shorter long side, finish faster. Strength changes how much of the photo remains. It does not change the step count.

Limits

One image per request. Photos larger than 20 MB or 4096 pixels on a side are refused. The prompt cannot be longer than 1000 characters, and the negative prompt cannot be longer than 500. Strength outside 0.1–1.0, steps outside 1–50, guidance outside 0–15, and a seed outside -1 … 2147483647 are refused. A very small photo is scaled up to at least 64 pixels on each side. The result follows the prompt loosely and can change faces, text and small objects. High strength replaces more of the original. The weights are public and permissively licensed. Do not use the output to impersonate a real person.

Kandinsky 2 2 Img2img inputs and output

NameTypeRequiredDefaultDetails
imagefileYes—Photo to restyle. At most 20 MB and 4096 pixels on a side. The long side is resized to at most 1024, in steps of 64.
image/jpeg, png, webp
prompttextYes—Style or content to apply while keeping the photo's layout.
Max 1000 characters
negative_prompttextNolow quality, bad qualityWhat the image should avoid. The model card uses \"low quality, bad quality\".
Max 500 characters
strengthnumberNo0.15How far to move from the photo. Up to about 0.2 keeps the photo's layout; 0.3 (the model card's example) and above repaint it from the prompt.
0.1–1
num_inference_stepsintegerNo50Decoder steps. The card omits this (library default 100). Capped at 50 for this slice.
1–50
guidance_scalenumberNo4.0Prior and decoder guidance. The image-to-image example omits this, so 4.0 is the library default.
0–15
seedintegerNo-1Repeat a previous result. Leave at -1 for a new one each time.
-1–2147483647

Output. Returns binary file.

Run Kandinsky 2 2 Img2img 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=KANDINSKY_2_2_IMG2IMG" \
  -H "X-API-Key: kg_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "input": {
    "image": "https://example.com/input.png",
    "prompt": "example",
    "guidance_scale": 4.0,
    "negative_prompt": "low quality, bad quality",
    "num_inference_steps": 50,
    "seed": -1,
    "strength": 0.15
  },
  "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(
        "KANDINSKY_2_2_IMG2IMG",
        {
          "image": "https://example.com/input.png",
          "prompt": "example",
          "guidance_scale": 4.0,
          "negative_prompt": "low quality, bad quality",
          "num_inference_steps": 50,
          "seed": -1,
          "strength": 0.15
        },
        output_format="json",
    )
    result = client.executions.await_completion(submitted.id)
    print(result.execution.output)

Kandinsky 2 2 Img2img pricing

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

Licence and source

Kandinsky 2 2 Inpaint: Image Editing model on Kainguru
Image Editing

Kandinsky 2 2 Inpaint

Kandinsky 2.2 inpainting: paints the masked part of a photo from a text prompt and leaves the rest untouched.

Qwen-Image-Edit-2509: Image Editing model on Kainguru
Image Editing

Qwen-Image-Edit-2509

Edit a picture from a written instruction, changing objects, people, text or style while keeping the rest consistent.

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

DDColor

Colourises black-and-white and faded photos: it keeps each photo's own light and shade and adds natural colours.

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

LaMa

Removes objects, text, watermarks and blemishes from a photo: paint what to remove white on a black mask, and it fills…

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
LongCat Image Edit: Image Editing model on Kainguru
Image Editing

LongCat Image Edit

Edits a picture from an instruction in English or Chinese with LongCat-Image-Edit (6B, Apache-2.0): local and global…

Fine-tunable