@bluepic/embed 0.4.0-next.94 → 0.4.0-next.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,8 @@ export type ApplyAutoCropOptions = {
8
8
  };
9
9
  aspectRatio: number;
10
10
  cropMode: Template.ImageValue['cropMode'];
11
+ /** Tighten the crop around the faces instead of keeping full resolution. */
12
+ zoom?: boolean;
11
13
  };
12
14
  /**
13
15
  * Full auto-crop pass for one image: load → detect → solve.
@@ -13,6 +13,13 @@ export declare const MIN_FACE_SCORE = 0.6;
13
13
  * approximates that while staying safe for group shots.
14
14
  */
15
15
  export declare const FACE_VERTICAL_ANCHOR = 0.4;
16
+ /**
17
+ * Margin kept around the face union box when `zoom` is on, as a fraction of the
18
+ * face box size on each side. 0.6 → the crop is ~2.2× the face box, which reads
19
+ * as a comfortable headshot rather than a tight passport cut. Only consulted
20
+ * when zooming is requested; the default policy ignores it entirely.
21
+ */
22
+ export declare const FACE_ZOOM_PADDING = 0.6;
16
23
  export type SolveAutoCropOptions = {
17
24
  faces: FaceBox[];
18
25
  /** Natural (unscaled) image dimensions in pixels. */
@@ -23,6 +30,12 @@ export type SolveAutoCropOptions = {
23
30
  /** Target aspect ratio of the field (width / height). */
24
31
  aspectRatio: number;
25
32
  cropMode: Template.ImageValue['cropMode'];
33
+ /**
34
+ * When true, tighten the crop around the detected faces instead of keeping
35
+ * the largest possible rectangle. Off by default because zooming throws away
36
+ * resolution; opt in when framing matters more than pixels.
37
+ */
38
+ zoom?: boolean;
26
39
  };
27
40
  /**
28
41
  * Propose a crop rectangle that frames the detected faces.
@@ -31,9 +44,11 @@ export type SolveAutoCropOptions = {
31
44
  * degenerate input, or a crop mode where cropping isn't what happens. `null`
32
45
  * means "leave the existing default alone", never "error".
33
46
  *
34
- * The geometry mirrors what `cover` already does: the crop is the largest
35
- * rectangle of the target ratio that fits inside the image (so no pixels are
36
- * wasted), slid so the faces are well framed. It never zooms in — cropping
37
- * tighter than necessary would throw away resolution the renderer wants.
47
+ * By default the geometry mirrors what `cover` already does: the crop is the
48
+ * largest rectangle of the target ratio that fits inside the image (so no
49
+ * pixels are wasted), slid so the faces are well framed it never zooms in,
50
+ * because cropping tighter than necessary throws away resolution the renderer
51
+ * wants. Pass `zoom` to opt into the opposite trade-off: tighten the crop
52
+ * around the faces (down to the padded union box) at the cost of resolution.
38
53
  */
39
54
  export declare function solveAutoCrop(opts: SolveAutoCropOptions): Template.Crop | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluepic/embed",
3
- "version": "0.4.0-next.94",
3
+ "version": "0.4.0-next.96",
4
4
  "description": "Bluepic embed sdk",
5
5
  "type": "module",
6
6
  "sideEffects": false,