Kling IMAGE 4.0

Kling IMAGE 4.0 is an image model for text-to-image and reference-guided generation at native 2K, 4K, and 8K, with natural lighting and skin and material detail close to a camera photo. It renders up to 2,000 characters of legible text in seven languages, combines up to 10 reference images and elements, and plans series of up to 10 images that keep subjects and style consistent. It also designs e-commerce product pages and websites as a single tall image, which suits storyboards, slide decks, product shoots, and campaign visuals.

Complete technical specification for integration
Ready-to-use code snippets for common workflows
Step-by-step tutorials for advanced use cases
← All GuidesEditing images
How to edit a photo with Kling IMAGE 4.0: recoloring a product to HEX values, replacing a studio background, retouching haze and color casts, and adding motion blur.
Introduction
A product that comes in four colorways needs one photo, not four shoots. Send the photo you have, describe the change, and Kling IMAGE 4.0 renders the photo again with that change made. The shoes below went in off-white and came back in a navy and orange colorway set by HEX values.
Each HEX value names one part of the shoe, and the last sentence of the prompt lists what stays: the knit, the shape, the backdrop and the light.
This guide covers the request, how to write an instruction, replacing a studio background, retouching haze and color casts, and adding camera effects. Building a new image out of several inputs is covered in reference images.
The request
An edit is a generation request with the photo attached in inputs.referenceImages. The instruction goes in positivePrompt:
import { createClient } from '@runware/sdk'
const client = await createClient({ apiKey: process.env.RUNWARE_API_KEY })
await client.connect()
const [result] = await client.run({
model: 'klingai:kling-image@4.0',
positivePrompt: 'Change only the colors of the shoes. Make the knit uppers HEX #1F3A5F, the laces and heel tabs HEX #FF7A1A, and keep the midsoles white. Keep the knit texture, the shape of each shoe, the backdrop, the shadows, the framing and the lighting exactly as they are, so the image looks as if this colorway was the one photographed.',
inputs: {
referenceImages: [
'https://assets.runware.ai/guides/klingai-image-4-0/editing-images/source-shoes.jpg'
]
},
width: 2336,
height: 1760
})import asyncio
import os
from runware import Runware
async def main():
async with Runware(api_key=os.environ["RUNWARE_API_KEY"]) as client:
results = await client.run({
"model": "klingai:kling-image@4.0",
"positivePrompt": "Change only the colors of the shoes. Make the knit uppers HEX #1F3A5F, the laces and heel tabs HEX #FF7A1A, and keep the midsoles white. Keep the knit texture, the shape of each shoe, the backdrop, the shadows, the framing and the lighting exactly as they are, so the image looks as if this colorway was the one photographed.",
"inputs": {
"referenceImages": [
"https://assets.runware.ai/guides/klingai-image-4-0/editing-images/source-shoes.jpg"
]
},
"width": 2336,
"height": 1760
})
asyncio.run(main())curl https://api.runware.ai/v1 \
-H "Authorization: Bearer $RUNWARE_API_KEY" \
-H "Content-Type: application/json" \
-d '[
{
"taskType": "imageInference",
"taskUUID": "c3d9e1f4-6a2b-4c87-9e05-1b7f4a8d2c66",
"model": "klingai:kling-image@4.0",
"positivePrompt": "Change only the colors of the shoes. Make the knit uppers HEX #1F3A5F, the laces and heel tabs HEX #FF7A1A, and keep the midsoles white. Keep the knit texture, the shape of each shoe, the backdrop, the shadows, the framing and the lighting exactly as they are, so the image looks as if this colorway was the one photographed.",
"inputs": {
"referenceImages": [
"https://assets.runware.ai/guides/klingai-image-4-0/editing-images/source-shoes.jpg"
]
},
"width": 2336,
"height": 1760
}
]'runware run klingai:kling-image@4.0 \
positivePrompt="Change only the colors of the shoes. Make the knit uppers HEX #1F3A5F, the laces and heel tabs HEX #FF7A1A, and keep the midsoles white. Keep the knit texture, the shape of each shoe, the backdrop, the shadows, the framing and the lighting exactly as they are, so the image looks as if this colorway was the one photographed." \
inputs.referenceImages.0=https://assets.runware.ai/guides/klingai-image-4-0/editing-images/source-shoes.jpg \
width=2336 \
height=1760{
"taskType": "imageInference",
"taskUUID": "c3d9e1f4-6a2b-4c87-9e05-1b7f4a8d2c66",
"model": "klingai:kling-image@4.0",
"positivePrompt": "Change only the colors of the shoes. Make the knit uppers HEX #1F3A5F, the laces and heel tabs HEX #FF7A1A, and keep the midsoles white. Keep the knit texture, the shape of each shoe, the backdrop, the shadows, the framing and the lighting exactly as they are, so the image looks as if this colorway was the one photographed.",
"inputs": {
"referenceImages": [
"https://assets.runware.ai/guides/klingai-image-4-0/editing-images/source-shoes.jpg"
]
},
"width": 2336,
"height": 1760
}Response
[
{
"taskType": "imageInference",
"taskUUID": "c3d9e1f4-6a2b-4c87-9e05-1b7f4a8d2c66",
"imageUUID": "5a8f2d6c-1e47-4b93-a0c8-7d3e9b4f1a25",
"imageURL": "https://im.runware.ai/image/os/a14d18/ws/2/ii/5a8f2d6c-1e47-4b93-a0c8-7d3e9b4f1a25.jpg"
}
]inputs.referenceImagestakes the photo as a URL, a UUID (a previous generation's, or one uploaded via Media Storage), a data URI or base64. Each image needs at least 300 pixels on both sides, an aspect ratio between 2:5 and 5:2, and a size of up to 30 MB.- Leave the size out and the edit keeps the photo's aspect ratio at the 2K tier.
resolutionpicks4Kor8Kinstead, still in the photo's ratio. - Send
widthandheightwhen the result has to line up with the source, as every before and after on this page does. Use the pair at the photo's own ratio.
Writing the instruction
An instruction has a change and a keep list. The shoe prompt, clause by clause:
"Only the colors" fences the change to one property of one object, and every HEX value has a named part to land on. "Keep the midsoles white" matters as much as the new colors, since a part the instruction never mentions is a part the model may recolor along with the rest.
The keep list names categories. "The backdrop" and "the lighting" cover everything in them without describing the photo back to the model. The last clause, "as if this colorway was the one photographed", asks for an image that reads as a real photo rather than a recolored one.
A keep list holds what the photo shows, and the model still draws it again. The shape of each shoe, the backdrop and the light carried over, while the knit on the toe came back with a different pattern of holes. When everything outside the change has to match the source pixel for pixel, composite the edited area back over the original.
Replacing a studio background
One instruction can clear a green screen and its whole rig. Ask for the relight as well, so the subject takes the light of the new place instead of keeping the studio's.
Name everything that has to go. "The green screen, the lighting trusses and the softboxes" covers each studio element by name, and "replace the rubber mat" swaps the floor too, since a studio mat on a rooftop would give the composite away. The relight sentence then places the light and the shadow: warm sun from the right, a rim on her shoulders and a contact shadow on the deck.
Retouching
Retouching changes how the photo looks and keeps everything in it in place. Kling suggests opening with the full keep list, "without changing any content, objects, composition or camera position", and then naming the one correction to make.
Removing haze
End a retouch with what to avoid. "Avoid oversharpening, halos and an HDR look" names the ways a dehaze can overshoot, so the result stays a listing photo instead of an over-processed one.
Correcting a color cast
Give the model a neutral to aim for. "So the white shirt reads white" is a reference point inside the photo, which is how a colorist would balance it. "Avoid smoothing the skin" keeps the correction from turning into a beauty retouch.
The face is drawn again as well. Its brows and the lines around the eyes differ from the source in detail, so compare a retouched portrait with the original before it replaces it.
Camera effects
An edit can add what a camera would have done to a sharp photo, such as the motion blur of a tracking shot. Hold the content fixed and describe the effect as the camera's movement:
Describe what caused the effect. "As if the camera moved alongside the rider at the same speed with a slow shutter" tells the model which parts stay sharp and which way the blur runs, which "add motion blur" alone leaves open.
Tips
-
Name the change, then list what stays. Categories such as "the backdrop" and "the lighting" are enough for the keep list.
-
Put each HEX value on a named part. Say which parts keep their color too, or they may change along with the rest.
-
Send the source's own size to line up a before and after. Leave the size out and the edit still keeps the photo's ratio.
-
Ask for a relight when the background changes. Light direction, a rim and a contact shadow keep the subject from looking pasted in.
-
Open retouches with "without changing any content". Then name the one correction, and close with what to avoid.
-
Describe camera effects as camera movement. The movement decides what blurs and in which direction.
-
Compare fine detail with the source. An edit redraws the frame, so a knit pattern or a face can change in detail even when the keep list names it.









