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": 1080,
"height": 1920
},
"output_format": "png",
"layers": [
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 180.0,
"colors": [
{
"hex_color": "#0F0A1A",
"position": 0.0
},
{
"hex_color": "#1B1464",
"position": 50.0
},
{
"hex_color": "#2D1B69",
"position": 100.0
}
],
"position": {
"x": 0.0,
"y": 0.0
},
"dimensions": {
"width": 1080,
"height": 1920
}
},
{
"index": 1,
"type": "text",
"text": "What if the person you trusted most\nwas the one keeping the secret?",
"font_name": "Lora",
"font_size_in_px": 36,
"text_color": "#E2E8F0",
"font_weight": "Regular",
"font_style": "Italic",
"text_align": "center",
"position": {
"x": 80.0,
"y": 140.0
},
"dimensions": {
"width": 920,
"height": 200
}
},
{
"index": 2,
"type": "image",
"buffer": "<base64-encoded-book-cover>",
"position": {
"x": 240.0,
"y": 420.0
},
"dimensions": {
"width": 600,
"height": 900
}
},
{
"index": 3,
"type": "text",
"text": "THE ASHWORTH CHRONICLES",
"font_name": "Montserrat",
"font_size_in_px": 16,
"text_color": "#6C63FF",
"font_weight": "Bold",
"text_align": "center",
"position": {
"x": 80.0,
"y": 1400.0
},
"dimensions": {
"width": 920,
"height": 28
}
},
{
"index": 4,
"type": "text",
"text": "The Long Silence",
"font_name": "PlayfairDisplay",
"font_size_in_px": 48,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"position": {
"x": 80.0,
"y": 1450.0
},
"dimensions": {
"width": 920,
"height": 70
}
},
{
"index": 5,
"type": "text",
"text": "by Elizabeth Ashworth",
"font_name": "Lora",
"font_size_in_px": 22,
"text_color": "#94A3B8",
"text_align": "center",
"position": {
"x": 80.0,
"y": 1540.0
},
"dimensions": {
"width": 920,
"height": 36
}
},
{
"index": 6,
"type": "solid-color",
"hex_color": "#6C63FF",
"position": {
"x": 340.0,
"y": 1660.0
},
"dimensions": {
"width": 400,
"height": 56
}
},
{
"index": 7,
"type": "text",
"text": "Read the first chapter free",
"font_name": "Montserrat",
"font_size_in_px": 18,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"vertical_align": "center",
"position": {
"x": 340.0,
"y": 1660.0
},
"dimensions": {
"width": 400,
"height": 56
}
}
]
}'{
"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: 1080,
height_in_px: 1920,
},
output_format: "png",
layers: [
{
index: 0,
type: "gradient",
gradient_type: "linear",
angle_in_degrees: 180.0,
colors: [
{
hex_color: "#0F0A1A",
position: 0.0,
},
{
hex_color: "#1B1464",
position: 50.0,
},
{
hex_color: "#2D1B69",
position: 100.0,
},
],
position: {
x: 0.0,
y: 0.0,
},
dimensions: {
width_in_px: 1080,
height_in_px: 1920,
},
},
{
index: 1,
type: "text",
text: "What if the person you trusted most\nwas the one keeping the secret?",
font_name: "Lora",
font_size_in_px: 36,
text_color: "#E2E8F0",
font_weight: "Regular",
font_style: "Italic",
text_align: "center",
position: {
x: 80.0,
y: 140.0,
},
dimensions: {
width_in_px: 920,
height_in_px: 200,
},
},
{
index: 2,
type: "image",
buffer: bookCoverBase64,
position: {
x: 240.0,
y: 420.0,
},
dimensions: {
width_in_px: 600,
height_in_px: 900,
},
},
{
index: 3,
type: "text",
text: "THE ASHWORTH CHRONICLES",
font_name: "Montserrat",
font_size_in_px: 16,
text_color: "#6C63FF",
font_weight: "Bold",
text_align: "center",
position: {
x: 80.0,
y: 1400.0,
},
dimensions: {
width_in_px: 920,
height_in_px: 28,
},
},
{
index: 4,
type: "text",
text: "The Long Silence",
font_name: "PlayfairDisplay",
font_size_in_px: 48,
text_color: "#FFFFFF",
font_weight: "Bold",
text_align: "center",
position: {
x: 80.0,
y: 1450.0,
},
dimensions: {
width_in_px: 920,
height_in_px: 70,
},
},
{
index: 5,
type: "text",
text: "by Elizabeth Ashworth",
font_name: "Lora",
font_size_in_px: 22,
text_color: "#94A3B8",
text_align: "center",
position: {
x: 80.0,
y: 1540.0,
},
dimensions: {
width_in_px: 920,
height_in_px: 36,
},
},
{
index: 6,
type: "solid-color",
hex_color: "#6C63FF",
position: {
x: 340.0,
y: 1660.0,
},
dimensions: {
width_in_px: 400,
height_in_px: 56,
},
},
{
index: 7,
type: "text",
text: "Read the first chapter free",
font_name: "Montserrat",
font_size_in_px: 18,
text_color: "#FFFFFF",
font_weight: "Bold",
text_align: "center",
vertical_align: "center",
position: {
x: 340.0,
y: 1660.0,
},
dimensions: {
width_in_px: 400,
height_in_px: 56,
},
},
],
});{
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")
result = client.generate_image(
dimensions={
"width_in_px": 1080,
"height_in_px": 1920,
},
output_format="png",
layers=[
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 180.0,
"colors": [
{
"hex_color": "#0F0A1A",
"position": 0.0,
},
{
"hex_color": "#1B1464",
"position": 50.0,
},
{
"hex_color": "#2D1B69",
"position": 100.0,
},
],
"position": {
"x": 0.0,
"y": 0.0,
},
"dimensions": {
"width_in_px": 1080,
"height_in_px": 1920,
},
},
{
"index": 1,
"type": "text",
"text": "What if the person you trusted most\nwas the one keeping the secret?",
"font_name": "Lora",
"font_size_in_px": 36,
"text_color": "#E2E8F0",
"font_weight": "Regular",
"font_style": "Italic",
"text_align": "center",
"position": {
"x": 80.0,
"y": 140.0,
},
"dimensions": {
"width_in_px": 920,
"height_in_px": 200,
},
},
{
"index": 2,
"type": "image",
"buffer": book_cover_base64,
"position": {
"x": 240.0,
"y": 420.0,
},
"dimensions": {
"width_in_px": 600,
"height_in_px": 900,
},
},
{
"index": 3,
"type": "text",
"text": "THE ASHWORTH CHRONICLES",
"font_name": "Montserrat",
"font_size_in_px": 16,
"text_color": "#6C63FF",
"font_weight": "Bold",
"text_align": "center",
"position": {
"x": 80.0,
"y": 1400.0,
},
"dimensions": {
"width_in_px": 920,
"height_in_px": 28,
},
},
{
"index": 4,
"type": "text",
"text": "The Long Silence",
"font_name": "PlayfairDisplay",
"font_size_in_px": 48,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"position": {
"x": 80.0,
"y": 1450.0,
},
"dimensions": {
"width_in_px": 920,
"height_in_px": 70,
},
},
{
"index": 5,
"type": "text",
"text": "by Elizabeth Ashworth",
"font_name": "Lora",
"font_size_in_px": 22,
"text_color": "#94A3B8",
"text_align": "center",
"position": {
"x": 80.0,
"y": 1540.0,
},
"dimensions": {
"width_in_px": 920,
"height_in_px": 36,
},
},
{
"index": 6,
"type": "solid-color",
"hex_color": "#6C63FF",
"position": {
"x": 340.0,
"y": 1660.0,
},
"dimensions": {
"width_in_px": 400,
"height_in_px": 56,
},
},
{
"index": 7,
"type": "text",
"text": "Read the first chapter free",
"font_name": "Montserrat",
"font_size_in_px": 18,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"vertical_align": "center",
"position": {
"x": 340.0,
"y": 1660.0,
},
"dimensions": {
"width_in_px": 400,
"height_in_px": 56,
},
},
],
){
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}package main
import il "github.com/iterationlayer/sdk-go"
func main() {
client := il.NewClient("YOUR_API_KEY")
result, err := client.GenerateImage(il.GenerateImageRequest{
Dimensions: il.Dimensions{
WidthInPx: 1080,
HeightInPx: 1920,
},
OutputFormat: "png",
Layers: []il.Layer{
il.NewGradientLayer(0, "linear", []il.GradientColor{
{
HexColor: "#0F0A1A",
Position: 0.0,
},
{
HexColor: "#1B1464",
Position: 50.0,
},
{
HexColor: "#2D1B69",
Position: 100.0,
},
}, il.Position{
X: 0.0,
Y: 0.0,
}, il.Dimensions{
WidthInPx: 1080,
HeightInPx: 1920,
}),
il.NewTextLayer(1,
"What if the person you trusted most\nwas the one keeping the secret?",
"Lora", 36, "#E2E8F0",
il.Position{
X: 80.0,
Y: 140.0,
},
il.Dimensions{
WidthInPx: 920,
HeightInPx: 200,
}),
il.NewStaticImageLayer(2, bookCoverBase64,
il.Position{
X: 240.0,
Y: 420.0,
},
il.Dimensions{
WidthInPx: 600,
HeightInPx: 900,
}),
il.NewTextLayer(3, "THE ASHWORTH CHRONICLES", "Montserrat", 16, "#6C63FF",
il.Position{
X: 80.0,
Y: 1400.0,
},
il.Dimensions{
WidthInPx: 920,
HeightInPx: 28,
}),
il.NewTextLayer(4, "The Long Silence", "PlayfairDisplay", 48, "#FFFFFF",
il.Position{
X: 80.0,
Y: 1450.0,
},
il.Dimensions{
WidthInPx: 920,
HeightInPx: 70,
}),
il.NewTextLayer(5, "by Elizabeth Ashworth", "Lora", 22, "#94A3B8",
il.Position{
X: 80.0,
Y: 1540.0,
},
il.Dimensions{
WidthInPx: 920,
HeightInPx: 36,
}),
il.NewRectangleLayer(6, "#6C63FF",
il.Position{
X: 340.0,
Y: 1660.0,
},
il.Dimensions{
WidthInPx: 400,
HeightInPx: 56,
}),
il.NewTextLayer(7, "Read the first chapter free", "Montserrat", 18, "#FFFFFF",
il.Position{
X: 340.0,
Y: 1660.0,
},
il.Dimensions{
WidthInPx: 400,
HeightInPx: 56,
}),
},
})
if err != nil {
panic(err)
}
}{
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}