Focal point detection - Feature explained

Focal point detection - Feature explained

Purpose

The focal point feature attaches an anchor coordinate to an image asset, marking the visually important area (a face, a product, ...).

It can be set two ways :

  • Automatically at ingestion by a Gemini-based detector on the MC2 side.

  • Manually by an operator in the DAM editor

Both land in the same storage and serve the smartcrop transformation.

Golden rule - a focal point that is already stored is never recomputed automatically, whatever its origin. Only an explicit new manuel entry can replace it.

Prerequisites

  • MC2 must be configured and reachable.

  • Automatic detection needs to be enabled MC2 side :

Client setting

Default

Role

Client setting

Default

Role

IA.ImagesFocalPointDetection

false

Enables automatic detection at ingestion

Gemini.GeminiKey

(empty)

API key, provisioned per client, shared with other AI features

Gemini.GeminiFocalPointModel

gemini-3.1-flash-lite

Model used for detection

Gemini.GeminiFocalPointPrompt

(default prompt)

Instruction sent with the image

  • Automatic detection at ingestion is also opt-in per field on the engine side : the source image must carry the mc2/enableFocalPointDetection tag in the object structure configuration.
    Without it, detection stays disabled.

The smartcrop transformation

smartcropis one verb among the image transformation pipeline, chained on the fly via the asset’s transform URL (?t=smartcrop&ratiow=…&ratioh=…) or captured in named preset, both path go through the same focal-point injection.

Option

Alias

Required

Role

Option

Alias

Required

Role

ratiow

rw

yes (int > 0)

Target ratio width

ratioh

rh

yes (int > 0)

Target ratio height

focusx

fx

 

Focal point X, [0,1] default to 0.5

focusy

fy

 

Focal point Y, [0.1] default to 0.5

Crop algorithm, given the target ratio and the resolved fx / fy:

  1. Compare the target ratio to the image’s current ratio.

  2. Too wide for the target → keep full height, crop the width. Too tall → keep full width, crop the height.
    Only one axis is ever cropped : the other keeps its original size.

  3. Center that crop window on the focal point (fx / fy converted to pixel), then clamp it so it never runs past the image edges. A focal point near a border does not push the window out of bounds, it just stops being perfectly centered on it.

  4. If the image already matches the target ratio, no crop is applied at all (image returned unchanged, no re-encode).

APIs

Base path: /api/wedia/variations/smartcrop. Both endpoints require an authenticated, connected surfer (403 Forbidden otherwise) and return JSON.

Method

Path

Purpose

Method

Path

Purpose

GET

/focalpoint

Read the current focal point for an asset

POST

/focalpoint

Set/override the focal point for an asset