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": 600,
"height": 900
},
"output_format": "png",
"layers": [
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 180.0,
"colors": [
{ "hex_color": "#1B1464", "position": 0.0 },
{ "hex_color": "#6C63FF", "position": 100.0 }
],
"position": { "x": 0.0, "y": 0.0 },
"dimensions": { "width": 600, "height": 900 }
},
{
"index": 1,
"type": "text",
"text": "The Art of API Design",
"font_name": "Playfair Display",
"font_size_in_px": 52,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"position": { "x": 50.0, "y": 200.0 },
"dimensions": { "width": 500, "height": 200 }
},
{
"index": 2,
"type": "text",
"text": "Alexandra Chen",
"font_name": "Inter",
"font_size_in_px": 24,
"text_color": "#D4D0FF",
"text_align": "center",
"position": { "x": 50.0, "y": 750.0 },
"dimensions": { "width": 500, "height": 40 }
}
]
}'{
"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: 600, height_in_px: 900 },
output_format: "png",
layers: [
{
index: 0,
type: "gradient",
gradient_type: "linear",
angle_in_degrees: 180.0,
colors: [
{ hex_color: "#1B1464", position: 0.0 },
{ hex_color: "#6C63FF", position: 100.0 },
],
position: { x: 0.0, y: 0.0 },
dimensions: { width_in_px: 600, height_in_px: 900 },
},
{
index: 1,
type: "text",
text: "The Art of API Design",
font_name: "Playfair Display",
font_size_in_px: 52,
text_color: "#FFFFFF",
font_weight: "Bold",
text_align: "center",
position: { x: 50.0, y: 200.0 },
dimensions: { width_in_px: 500, height_in_px: 200 },
},
{
index: 2,
type: "text",
text: "Alexandra Chen",
font_name: "Inter",
font_size_in_px: 24,
text_color: "#D4D0FF",
text_align: "center",
position: { x: 50.0, y: 750.0 },
dimensions: { width_in_px: 500, height_in_px: 40 },
},
],
});
await Bun.write("result.png", 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": 600, "height_in_px": 900},
output_format="png",
layers=[
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 180.0,
"colors": [
{"hex_color": "#1B1464", "position": 0.0},
{"hex_color": "#6C63FF", "position": 100.0},
],
"position": {"x": 0.0, "y": 0.0},
"dimensions": {"width_in_px": 600, "height_in_px": 900},
},
{
"index": 1,
"type": "text",
"text": "The Art of API Design",
"font_name": "Playfair Display",
"font_size_in_px": 52,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"position": {"x": 50.0, "y": 200.0},
"dimensions": {"width_in_px": 500, "height_in_px": 200},
},
{
"index": 2,
"type": "text",
"text": "Alexandra Chen",
"font_name": "Inter",
"font_size_in_px": 24,
"text_color": "#D4D0FF",
"text_align": "center",
"position": {"x": 50.0, "y": 750.0},
"dimensions": {"width_in_px": 500, "height_in_px": 40},
},
],
)
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: 600, HeightInPx: 900},
OutputFormat: "png",
Layers: []il.Layer{
il.NewGradientLayer(0, "linear", []il.GradientColor{
{HexColor: "#1B1464", Position: 0.0},
{HexColor: "#6C63FF", Position: 100.0},
}, il.Position{X: 0.0, Y: 0.0}, il.Dimensions{WidthInPx: 600, HeightInPx: 900}),
il.NewTextLayer(1, "The Art of API Design", "Playfair Display", 52, "#FFFFFF",
il.Position{X: 50.0, Y: 200.0}, il.Dimensions{WidthInPx: 500, HeightInPx: 200}),
il.NewTextLayer(2, "Alexandra Chen", "Inter", 24, "#D4D0FF",
il.Position{X: 50.0, Y: 750.0}, il.Dimensions{WidthInPx: 500, HeightInPx: 40}),
},
})
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"
}
}