Focal Crop Geometry

Calculate the largest exact-aspect pixel crop while keeping a focal point as close to the crop center as image bounds allow.

Custom requests cost 0.04 USDC on Base.

Download example JSON · OpenAPI · Source and usage

Pay with a browser wallet · Open example in checkout

POST a JSON request to /focal-crop-geometry/v1/check with an x402 V2 client.

Worked example

Request

{
  "image_width": 1200,
  "image_height": 800,
  "ratio_width": 1,
  "ratio_height": 1,
  "focal_x": 1000,
  "focal_y": 300
}

Result

{
  "crop": {
    "x": 400,
    "y": 0,
    "width": 800,
    "height": 800
  },
  "focal_in_crop": {
    "x": 600,
    "y": 300
  }
}

Support catalog maintenance through GitHub Sponsors. Sponsor gptenv · Sponsor Jeremy Carter