Smart Crop Product Image

AI-powered subject-aware crop that centers on the product regardless of its position in the frame.

Who this is for

E-commerce platforms and marketplaces use this recipe to normalize supplier product photos to consistent square thumbnails. AI detects the product and crops around it — no manual positioning, no lost products at the edges.

Request
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": "supplier-image.jpg",
      "url": "https://cdn.example.com/supplier/product-001.jpg"
    },
    "operations": [
      {
        "type": "smart_crop",
        "width_in_px": 1000,
        "height_in_px": 1000
      }
    ]
  }'
Response
{
  "success": true,
  "data": {
    "buffer": "/9j/4AAQSkZJRgABAQEASABI...",
    "mime_type": "image/jpeg"
  }
}
Request
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

const result = await client.transform({
  file: {
    type: "url",
    name: "supplier-image.jpg",
    url: "https://cdn.example.com/supplier/product-001.jpg",
  },
  operations: [
    {
      type: "smart_crop",
      width_in_px: 1000,
      height_in_px: 1000,
    },
  ],
});
Response
{
  "success": true,
  "data": {
    "buffer": "/9j/4AAQSkZJRgABAQEASABI...",
    "mime_type": "image/jpeg"
  }
}
Request
from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

result = client.transform(
    file={
        "type": "url",
        "name": "supplier-image.jpg",
        "url": "https://cdn.example.com/supplier/product-001.jpg",
    },
    operations=[
        {
            "type": "smart_crop",
            "width_in_px": 1000,
            "height_in_px": 1000,
        },
    ],
)
Response
{
  "success": true,
  "data": {
    "buffer": "/9j/4AAQSkZJRgABAQEASABI...",
    "mime_type": "image/jpeg"
  }
}
Request
package main

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

func main() {
    client := il.NewClient("YOUR_API_KEY")

    result, err := client.Transform(il.TransformRequest{
        File: il.NewFileFromURL(
            "supplier-image.jpg",
            "https://cdn.example.com/supplier/product-001.jpg",
        ),
        Operations: []il.TransformOperation{
            il.NewSmartCropOperation(1000, 1000),
        },
    })
    if err != nil {
        panic(err)
    }
}
Response
{
  "success": true,
  "data": {
    "buffer": "/9j/4AAQSkZJRgABAQEASABI...",
    "mime_type": "image/jpeg"
  }
}

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.