Crop.photo
  1. Crop.photo API
Crop.photo
  • Crop.photo API
    • Introduction
    • Authentication
    • FAQs
    • Examples
    • Interactive API Testing
    • Auto Resize & Align
      POST
    • Body Aware Crop
      POST
    • Unrecognizable Crop
      POST
    • Remove Background
      POST
    • Create Banner Job
      POST
    • AI Lifestyle Crop
      POST
    • Banners Job Status
      POST
  1. Crop.photo API

Auto Resize & Align

POST
/crop/auto-resize-align
Auto resize and align in Crop.photo, seamlessly resize and align your products within the frame while replacing the background with given color or background image.
This feature guarantees a polished appearance for a diverse range of products, including shoes, beverages, and home decor, enhancing the overall visual presentation.
Maintaining a consistent eye level significantly improves the browsing experience across various aspect ratios on your online storefront. The Auto Resize & Align API ensures precise alignment and sizing of the focal object, typically a product.
Example 1:
To resize the input image to a 2000x3000 dimension and automatically align the product in the center with uniform 8% margins around it, use the API as follows:

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Body Params application/json

Example
{
    "image_url": "https://acme.s3.aws.com/image.png",
    "background": "white",
    "preserve_edge_contact": "true",
    "output_format": "auto",
    "output_dimension": "1080x1080",
    "response_type": "stream",
    "margins": {
        "horizontal_alignment": "center",
        "horizontal_margin": 0,
        "vertical_alignment": "center",
        "vertical_margin": 0,
        "minimum_margin": 8
    }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://us1-api.crop.photo/v1/crop/auto-resize-align' \
--header 'Content-Type: application/json' \
--data-raw '{
    "image_url": "https://acme.s3.aws.com/image.png",
    "background": "white",
    "preserve_edge_contact": "true",
    "output_format": "auto",
    "output_dimension": "1080x1080",
    "response_type": "stream",
    "margins": {
        "horizontal_alignment": "center",
        "horizontal_margin": 0,
        "vertical_alignment": "center",
        "vertical_margin": 0,
        "minimum_margin": 8
    }
}'

Responses

🟢200Binary Octel Stream Response
application/octet-stream
Body

🟢200Image Crop Response JSON
🟢200Success
🟠401Unauthorized
🟠400Invalid Input | Crop.photo
Modified at 2025-03-17 15:49:11
Previous
Interactive API Testing
Next
Body Aware Crop
Built with