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": 970,
"height": 600
},
"output_format": "png",
"layers": [
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 135.0,
"colors": [
{
"hex_color": "#1B2838",
"position": 0.0
},
{
"hex_color": "#2D3A4A",
"position": 100.0
}
],
"position": {
"x": 0.0,
"y": 0.0
},
"dimensions": {
"width": 970,
"height": 600
}
},
{
"index": 1,
"type": "image",
"buffer": "<base64-encoded-book-cover>",
"position": {
"x": 60.0,
"y": 60.0
},
"dimensions": {
"width": 320,
"height": 480
}
},
{
"index": 2,
"type": "text",
"text": "THE ASHWORTH CHRONICLES",
"font_name": "Montserrat",
"font_size_in_px": 14,
"text_color": "#94A3B8",
"font_weight": "Bold",
"position": {
"x": 440.0,
"y": 80.0
},
"dimensions": {
"width": 480,
"height": 24
}
},
{
"index": 3,
"type": "text",
"text": "The Long Silence",
"font_name": "PlayfairDisplay",
"font_size_in_px": 44,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"position": {
"x": 440.0,
"y": 120.0
},
"dimensions": {
"width": 480,
"height": 110
}
},
{
"index": 4,
"type": "text",
"text": "Elizabeth Ashworth",
"font_name": "Lora",
"font_size_in_px": 20,
"text_color": "#CBD5E1",
"position": {
"x": 440.0,
"y": 250.0
},
"dimensions": {
"width": 480,
"height": 32
}
},
{
"index": 5,
"type": "solid-color",
"hex_color": "#6C63FF",
"position": {
"x": 440.0,
"y": 320.0
},
"dimensions": {
"width": 120,
"height": 32
}
},
{
"index": 6,
"type": "text",
"text": "THRILLER",
"font_name": "Montserrat",
"font_size_in_px": 12,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"vertical_align": "center",
"position": {
"x": 440.0,
"y": 320.0
},
"dimensions": {
"width": 120,
"height": 32
}
},
{
"index": 7,
"type": "solid-color",
"hex_color": "#22C55E",
"position": {
"x": 440.0,
"y": 480.0
},
"dimensions": {
"width": 180,
"height": 40
}
},
{
"index": 8,
"type": "text",
"text": "Available Now",
"font_name": "Montserrat",
"font_size_in_px": 14,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"vertical_align": "center",
"position": {
"x": 440.0,
"y": 480.0
},
"dimensions": {
"width": 180,
"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: 970,
height_in_px: 600,
},
output_format: "png",
layers: [
{
index: 0,
type: "gradient",
gradient_type: "linear",
angle_in_degrees: 135.0,
colors: [
{
hex_color: "#1B2838",
position: 0.0,
},
{
hex_color: "#2D3A4A",
position: 100.0,
},
],
position: {
x: 0.0,
y: 0.0,
},
dimensions: {
width_in_px: 970,
height_in_px: 600,
},
},
{
index: 1,
type: "image",
buffer: bookCoverBase64,
position: {
x: 60.0,
y: 60.0,
},
dimensions: {
width_in_px: 320,
height_in_px: 480,
},
},
{
index: 2,
type: "text",
text: "THE ASHWORTH CHRONICLES",
font_name: "Montserrat",
font_size_in_px: 14,
text_color: "#94A3B8",
font_weight: "Bold",
position: {
x: 440.0,
y: 80.0,
},
dimensions: {
width_in_px: 480,
height_in_px: 24,
},
},
{
index: 3,
type: "text",
text: "The Long Silence",
font_name: "PlayfairDisplay",
font_size_in_px: 44,
text_color: "#FFFFFF",
font_weight: "Bold",
position: {
x: 440.0,
y: 120.0,
},
dimensions: {
width_in_px: 480,
height_in_px: 110,
},
},
{
index: 4,
type: "text",
text: "Elizabeth Ashworth",
font_name: "Lora",
font_size_in_px: 20,
text_color: "#CBD5E1",
position: {
x: 440.0,
y: 250.0,
},
dimensions: {
width_in_px: 480,
height_in_px: 32,
},
},
{
index: 5,
type: "solid-color",
hex_color: "#6C63FF",
position: {
x: 440.0,
y: 320.0,
},
dimensions: {
width_in_px: 120,
height_in_px: 32,
},
},
{
index: 6,
type: "text",
text: "THRILLER",
font_name: "Montserrat",
font_size_in_px: 12,
text_color: "#FFFFFF",
font_weight: "Bold",
text_align: "center",
vertical_align: "center",
position: {
x: 440.0,
y: 320.0,
},
dimensions: {
width_in_px: 120,
height_in_px: 32,
},
},
{
index: 7,
type: "solid-color",
hex_color: "#22C55E",
position: {
x: 440.0,
y: 480.0,
},
dimensions: {
width_in_px: 180,
height_in_px: 40,
},
},
{
index: 8,
type: "text",
text: "Available Now",
font_name: "Montserrat",
font_size_in_px: 14,
text_color: "#FFFFFF",
font_weight: "Bold",
text_align: "center",
vertical_align: "center",
position: {
x: 440.0,
y: 480.0,
},
dimensions: {
width_in_px: 180,
height_in_px: 40,
},
},
],
});{
"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": 970,
"height_in_px": 600,
},
output_format="png",
layers=[
{
"index": 0,
"type": "gradient",
"gradient_type": "linear",
"angle_in_degrees": 135.0,
"colors": [
{
"hex_color": "#1B2838",
"position": 0.0,
},
{
"hex_color": "#2D3A4A",
"position": 100.0,
},
],
"position": {
"x": 0.0,
"y": 0.0,
},
"dimensions": {
"width_in_px": 970,
"height_in_px": 600,
},
},
{
"index": 1,
"type": "image",
"buffer": book_cover_base64,
"position": {
"x": 60.0,
"y": 60.0,
},
"dimensions": {
"width_in_px": 320,
"height_in_px": 480,
},
},
{
"index": 2,
"type": "text",
"text": "THE ASHWORTH CHRONICLES",
"font_name": "Montserrat",
"font_size_in_px": 14,
"text_color": "#94A3B8",
"font_weight": "Bold",
"position": {
"x": 440.0,
"y": 80.0,
},
"dimensions": {
"width_in_px": 480,
"height_in_px": 24,
},
},
{
"index": 3,
"type": "text",
"text": "The Long Silence",
"font_name": "PlayfairDisplay",
"font_size_in_px": 44,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"position": {
"x": 440.0,
"y": 120.0,
},
"dimensions": {
"width_in_px": 480,
"height_in_px": 110,
},
},
{
"index": 4,
"type": "text",
"text": "Elizabeth Ashworth",
"font_name": "Lora",
"font_size_in_px": 20,
"text_color": "#CBD5E1",
"position": {
"x": 440.0,
"y": 250.0,
},
"dimensions": {
"width_in_px": 480,
"height_in_px": 32,
},
},
{
"index": 5,
"type": "solid-color",
"hex_color": "#6C63FF",
"position": {
"x": 440.0,
"y": 320.0,
},
"dimensions": {
"width_in_px": 120,
"height_in_px": 32,
},
},
{
"index": 6,
"type": "text",
"text": "THRILLER",
"font_name": "Montserrat",
"font_size_in_px": 12,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"vertical_align": "center",
"position": {
"x": 440.0,
"y": 320.0,
},
"dimensions": {
"width_in_px": 120,
"height_in_px": 32,
},
},
{
"index": 7,
"type": "solid-color",
"hex_color": "#22C55E",
"position": {
"x": 440.0,
"y": 480.0,
},
"dimensions": {
"width_in_px": 180,
"height_in_px": 40,
},
},
{
"index": 8,
"type": "text",
"text": "Available Now",
"font_name": "Montserrat",
"font_size_in_px": 14,
"text_color": "#FFFFFF",
"font_weight": "Bold",
"text_align": "center",
"vertical_align": "center",
"position": {
"x": 440.0,
"y": 480.0,
},
"dimensions": {
"width_in_px": 180,
"height_in_px": 40,
},
},
],
){
"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: 970,
HeightInPx: 600,
},
OutputFormat: "png",
Layers: []il.Layer{
il.NewGradientLayer(0, "linear", []il.GradientColor{
{
HexColor: "#1B2838",
Position: 0.0,
},
{
HexColor: "#2D3A4A",
Position: 100.0,
},
}, il.Position{
X: 0.0,
Y: 0.0,
}, il.Dimensions{
WidthInPx: 970,
HeightInPx: 600,
}),
il.NewStaticImageLayer(1, bookCoverBase64,
il.Position{
X: 60.0,
Y: 60.0,
},
il.Dimensions{
WidthInPx: 320,
HeightInPx: 480,
}),
il.NewTextLayer(2, "THE ASHWORTH CHRONICLES", "Montserrat", 14, "#94A3B8",
il.Position{
X: 440.0,
Y: 80.0,
},
il.Dimensions{
WidthInPx: 480,
HeightInPx: 24,
}),
il.NewTextLayer(3, "The Long Silence", "PlayfairDisplay", 44, "#FFFFFF",
il.Position{
X: 440.0,
Y: 120.0,
},
il.Dimensions{
WidthInPx: 480,
HeightInPx: 110,
}),
il.NewTextLayer(4, "Elizabeth Ashworth", "Lora", 20, "#CBD5E1",
il.Position{
X: 440.0,
Y: 250.0,
},
il.Dimensions{
WidthInPx: 480,
HeightInPx: 32,
}),
il.NewRectangleLayer(5, "#6C63FF",
il.Position{
X: 440.0,
Y: 320.0,
},
il.Dimensions{
WidthInPx: 120,
HeightInPx: 32,
}),
il.NewTextLayer(6, "THRILLER", "Montserrat", 12, "#FFFFFF",
il.Position{
X: 440.0,
Y: 320.0,
},
il.Dimensions{
WidthInPx: 120,
HeightInPx: 32,
}),
il.NewRectangleLayer(7, "#22C55E",
il.Position{
X: 440.0,
Y: 480.0,
},
il.Dimensions{
WidthInPx: 180,
HeightInPx: 40,
}),
il.NewTextLayer(8, "Available Now", "Montserrat", 14, "#FFFFFF",
il.Position{
X: 440.0,
Y: 480.0,
},
il.Dimensions{
WidthInPx: 180,
HeightInPx: 40,
}),
},
})
if err != nil {
panic(err)
}
}{
"success": true,
"data": {
"buffer": "iVBORw0KGgoAAAANSUhEUgAA...",
"mime_type": "image/png"
}
}