Image to Image API
Image-to-image workflows use mode: "image_to_image" and pass source image URLs through image_urls.
Workflow
- Upload one or more source images with
POST /api/v1/files. - Pass the returned URLs to
image_urls. - Poll the generation result.
Example
curl https://img2vid.net/api/v1/generations \
-H "Authorization: Bearer $BUBLE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "google/nano-banana-pro",
"mode": "image_to_image",
"prompt": "Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look",
"image_urls": ["https://example.com/source-room.png"],
"aspect_ratio": "16:9",
"resolution": "1K",
"output_format": "png"
}'
Model input limits
| Model | Max source images | Formats | Max size |
|---|---|---|---|
google/nano-banana |
10 | jpg, png, webp, bmp, gif | 30 MB |
google/nano-banana-pro |
8 | jpg, jpeg, png, webp | 30 MB |
openai/gpt-image-2 |
16 | jpg, png, webp | 10 MB |
SDK examples
The SDK snippets below use the same public API shape as the HTTP examples: stable fields such as model, mode, prompt, and media URLs are passed directly, and model-specific options stay as flat generation parameters.
TypeScript / JavaScript
import { Buble } from '@buble/sdk';
const buble = new Buble();
const task = await buble.generations.create({
model: 'google/nano-banana-pro',
mode: 'image_to_image',
prompt:
'Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look',
image_urls: ['https://example.com/source-room.png'],
aspect_ratio: '16:9',
resolution: '1K',
output_format: 'png',
});
const result = await buble.generations.wait(task.data.id);
console.log(result.data);
Python
from buble_ai import Buble
client = Buble()
task = client.generations.create(
model='google/nano-banana-pro',
mode='image_to_image',
prompt='Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look',
image_urls=['https://example.com/source-room.png'],
aspect_ratio='16:9',
resolution='1K',
output_format='png',
)
result = client.generations.wait(task["data"]["id"])
print(result["data"])
Go
package main
import (
"context"
"fmt"
"log"
buble "github.com/bublehq/sdks/go"
)
func main() {
ctx := context.Background()
client := buble.NewClient()
task, err := client.Generations.Create(ctx, &buble.CreateGenerationRequest{
Model: "google/nano-banana-pro",
Mode: "image_to_image",
Prompt: "Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look",
ImageURLs: []string{"https://example.com/source-room.png"},
Params: map[string]any{
"aspect_ratio": "16:9",
"resolution": "1K",
"output_format": "png",
},
})
if err != nil {
log.Fatal(err)
}
result, err := client.Generations.Wait(ctx, task.Data.ID)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%+v\n", result.Data)
}
Rust
use buble::{Client, CreateGenerationRequest, WaitOptions};
#[tokio::main]
async fn main() -> buble::Result<()> {
let client = Client::from_env();
let task = client
.generations()
.create(
CreateGenerationRequest::new("google/nano-banana-pro")
.mode("image_to_image")
.prompt("Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look")
.image_urls(["https://example.com/source-room.png"])
.param("aspect_ratio", "16:9")?
.param("resolution", "1K")?
.param("output_format", "png")?,
)
.await?;
let result = client
.generations()
.wait(&task.data.id, WaitOptions::default())
.await?;
println!("{:?}", result.data);
Ok(())
}
Swift
import Buble
let client = try BubleClient.fromEnvironment()
let task = try await client.generations.create(
try CreateGenerationRequest(model: "google/nano-banana-pro")
.mode("image_to_image")
.prompt("Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look")
.imageURLs(["https://example.com/source-room.png"])
.param("aspect_ratio", "16:9")
.param("resolution", "1K")
.param("output_format", "png")
)
let result = try await client.generations.wait(task.data.id)
print(result.data)
Dart / Flutter
import 'package:buble/buble.dart';
Future<void> main() async {
final client = BubleClient.fromEnvironment();
final task = await client.generations.create(
CreateGenerationRequest(
model: 'google/nano-banana-pro',
mode: 'image_to_image',
prompt:
'Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look',
imageUrls: ['https://example.com/source-room.png'],
).withParams({
'aspect_ratio': '16:9',
'resolution': '1K',
'output_format': 'png',
}),
);
final result = await client.generations.wait(task.data.id);
print(result.data.raw);
}
Elixir
client = Buble.Client.new!()
{:ok, task} =
Buble.Generations.create(client, %{
model: "google/nano-banana-pro",
mode: "image_to_image",
prompt:
"Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look",
image_urls: ["https://example.com/source-room.png"],
aspect_ratio: "16:9",
resolution: "1K",
output_format: "png",
})
{:ok, result} = Buble.Generations.wait(client, get_in(task, ["data", "id"]))
IO.inspect(result["data"])
Java
import ai.buble.sdk.BubleClient;
import ai.buble.sdk.Envelope;
import ai.buble.sdk.generations.CreateGenerationRequest;
import ai.buble.sdk.generations.GenerationTask;
import java.util.List;
public class Example {
public static void main(String[] args) {
BubleClient client = BubleClient.fromEnv();
Envelope<GenerationTask> task = client.generations().create(
CreateGenerationRequest.builder()
.model("google/nano-banana-pro")
.mode("image_to_image")
.prompt("Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look")
.imageUrls(List.of("https://example.com/source-room.png"))
.param("aspect_ratio", "16:9")
.param("resolution", "1K")
.param("output_format", "png")
.build()
);
Envelope<GenerationTask> result = client.generations().wait(task.getData().getId());
System.out.println(result.getData().getStatus());
}
}
.NET
using Buble.Sdk;
using Buble.Sdk.Generations;
var client = BubleClient.FromEnv();
var request = new CreateGenerationRequest
{
Model = "google/nano-banana-pro",
Mode = "image_to_image",
Prompt = "Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look",
ImageUrls = new[] {"https://example.com/source-room.png"},
}
.WithParam("aspect_ratio", "16:9")
.WithParam("resolution", "1K")
.WithParam("output_format", "png");
var task = await client.Generations.CreateAsync(request);
var result = await client.Generations.WaitAsync(task!.Data!.Id!);
Console.WriteLine(result.Data.Status);
PHP
<?php
use Buble\BubleClient;
use Buble\Generations\CreateGenerationRequest;
$client = BubleClient::fromEnv();
$request = new CreateGenerationRequest(
model: 'google/nano-banana-pro',
mode: 'image_to_image',
prompt: 'Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look',
imageUrls: ['https://example.com/source-room.png'],
);
$task = $client->generations()->create(
$request
->withParam('aspect_ratio', '16:9')
->withParam('resolution', '1K')
->withParam('output_format', 'png')
);
$result = $client->generations()->wait($task['data']['id']);
print_r($result['data']);
Ruby
require 'buble'
client = Buble::Client.new
task = client.generations.create(
model: 'google/nano-banana-pro',
mode: 'image_to_image',
prompt: 'Turn this room into a warm Japandi interior with oak furniture, linen textures, soft daylight, and a calm premium editorial look',
image_urls: ['https://example.com/source-room.png'],
aspect_ratio: '16:9',
resolution: '1K',
output_format: 'png',
)
result = client.generations.wait(task['data']['id'])
puts result['data']