Create Social Media Variants

Resize images to platform-specific dimensions for Instagram, Twitter, LinkedIn, and Facebook.

Who this is for

Social media managers and marketing teams use this recipe to create correctly sized images for every platform. Upload one source image and resize it to platform-specific dimensions — ready for publishing across Instagram, Twitter, LinkedIn, and more.

curl -X POST https://api.iterationlayer.com/image-transformation/v1/transform \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file": {
      "type": "url",
      "name": "brand-image.jpg",
      "url": "https://example.com/brand-image.jpg"
    },
    "operations": [
      { "type": "resize", "width_in_px": 1080, "height_in_px": 1080, "fit": "cover" },
      { "type": "convert", "format": "jpeg", "quality": 90 }
    ]
  }'
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.transform({
  file: {
    type: "url",
    name: "brand-image.jpg",
    url: "https://example.com/brand-image.jpg",
  },
  operations: [
    { type: "resize", width_in_px: 1080, height_in_px: 1080, fit: "cover" },
    { type: "convert", format: "jpeg", quality: 90 },
  ],
});

const imageBuffer = Buffer.from(result.data.buffer, "base64");
import base64

from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.transform(
    file={
        "type": "url",
        "name": "brand-image.jpg",
        "url": "https://example.com/brand-image.jpg",
    },
    operations=[
        {"type": "resize", "width_in_px": 1080, "height_in_px": 1080, "fit": "cover"},
        {"type": "convert", "format": "jpeg", "quality": 90},
    ],
)

with open("result.jpeg", "wb") as f:
    f.write(base64.b64decode(result["data"]["buffer"]))
package main

import il "github.com/iterationlayer/sdk-go"

client := il.NewClient("YOUR_API_KEY")

result, err := client.Transform(il.TransformRequest{
    File: il.NewFileFromURL("brand-image.jpg", "https://example.com/brand-image.jpg"),
    Operations: []il.TransformOperation{
        il.NewResizeOperation(1080, 1080, "cover"),
        il.NewConvertOperation("jpeg"),
    },
})

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.