curl -X POST https://api.iterationlayer.com/image-generation/v1/render \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"dimensions": { "width": 1280, "height": 720 },
"layers": [
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 135.0,
"colors": [
{ "hex_color": "#FF6B00", "position": 0.0 },
{ "hex_color": "#D90429", "position": 100.0 }
],
"position": { "x": 0.0, "y": 0.0 },
"dimensions": { "width": 1280, "height": 720 }
},
{
"index": 1,
"type": "image",
"buffer": "<base64-encoded-subject-photo>",
"should_remove_background": true,
"position": { "x": 700.0, "y": 60.0 }
},
{
"index": 2,
"type": "text",
"text": "I Built an App in 24 Hours",
"font_name": "Montserrat",
"font_size_in_px": 64,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"position": { "x": 50.0, "y": 120.0 },
"dimensions": { "width": 620, "height": 280 }
},
{
"index": 3,
"type": "text",
"text": "Dev With Alex",
"font_name": "Inter",
"font_size_in_px": 28,
"text_color": "#FFF3E0",
"position": { "x": 50.0, "y": 560.0 },
"dimensions": { "width": 400, "height": 50 }
}
],
"output_format": "png"
}'{
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });
const result = await client.generateImage({
dimensions: { width_in_px: 1280, height_in_px: 720 },
output_format: "png",
layers: [
{
index: 0,
type: "gradient",
gradient_type: "linear",
angle_in_degrees: 135.0,
colors: [
{ hex_color: "#FF6B00", position: 0.0 },
{ hex_color: "#D90429", position: 100.0 },
],
position: { x_in_px: 0, y_in_px: 0 },
dimensions: { width_in_px: 1280, height_in_px: 720 },
},
{
index: 1,
type: "image",
buffer: "<base64-encoded-subject-photo>",
should_remove_background: true,
position: { x_in_px: 700, y_in_px: 60 },
},
{
index: 2,
type: "text",
text: "I Built an App in 24 Hours",
font_name: "Montserrat",
font_size_in_px: 64,
text_color: "#FFFFFF",
font_weight: "Bold",
position: { x_in_px: 50, y_in_px: 120 },
dimensions: { width_in_px: 620, height_in_px: 280 },
},
{
index: 3,
type: "text",
text: "Dev With Alex",
font_name: "Inter",
font_size_in_px: 28,
text_color: "#FFF3E0",
position: { x_in_px: 50, y_in_px: 560 },
dimensions: { width_in_px: 400, height_in_px: 50 },
},
],
});
const imageBuffer = Buffer.from(result.data.buffer, "base64");{
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}import base64
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")
result = client.generate_image(
dimensions={"width_in_px": 1280, "height_in_px": 720},
output_format="png",
layers=[
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 135.0,
"colors": [
{"hex_color": "#FF6B00", "position": 0.0},
{"hex_color": "#D90429", "position": 100.0},
],
"position": {"x_in_px": 0, "y_in_px": 0},
"dimensions": {"width_in_px": 1280, "height_in_px": 720},
},
{
"index": 1,
"type": "image",
"buffer": "<base64-encoded-subject-photo>",
"should_remove_background": True,
"position": {"x_in_px": 700, "y_in_px": 60},
},
{
"index": 2,
"type": "text",
"text": "I Built an App in 24 Hours",
"font_name": "Montserrat",
"font_size_in_px": 64,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"position": {"x_in_px": 50, "y_in_px": 120},
"dimensions": {"width_in_px": 620, "height_in_px": 280},
},
{
"index": 3,
"type": "text",
"text": "Dev With Alex",
"font_name": "Inter",
"font_size_in_px": 28,
"text_color": "#FFF3E0",
"position": {"x_in_px": 50, "y_in_px": 560},
"dimensions": {"width_in_px": 400, "height_in_px": 50},
},
],
)
with open("result.png", "wb") as f:
f.write(base64.b64decode(result["data"]["buffer"])){
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}package main
import (
"encoding/base64"
"os"
il "github.com/iterationlayer/sdk-go"
)
func main() {
client := il.NewClient("YOUR_API_KEY")
result, err := client.GenerateImage(il.GenerateImageRequest{
Dimensions: il.Dimensions{WidthInPx: 1280, HeightInPx: 720},
OutputFormat: "png",
Layers: []il.Layer{
il.NewGradientLayer(0, "linear", []il.GradientColor{
{HexColor: "#FF6B00", Position: 0.0},
{HexColor: "#D90429", Position: 100.0},
}, il.Position{XInPx: 0, YInPx: 0}, il.Dimensions{WidthInPx: 1280, HeightInPx: 720}),
il.NewStaticImageLayer(1, il.FileInput{Buffer: "<base64-encoded-subject-photo>"},
il.Position{XInPx: 700, YInPx: 60},
il.Dimensions{}),
il.NewTextLayer(2, "I Built an App in 24 Hours", "Montserrat", 64, "#FFFFFF",
il.Position{XInPx: 50, YInPx: 120},
il.Dimensions{WidthInPx: 620, HeightInPx: 280}),
il.NewTextLayer(3, "Dev With Alex", "Inter", 28, "#FFF3E0",
il.Position{XInPx: 50, YInPx: 560},
il.Dimensions{WidthInPx: 400, HeightInPx: 50}),
},
})
if err != nil {
panic(err)
}
decoded, _ := base64.StdEncoding.DecodeString(result.Data.Buffer)
os.WriteFile("result.png", decoded, 0644)
}{
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}