feat(smart-crop): overhaul with face detection, social presets, and 3 modes

Replace the confusing 2-mode smart crop with a clear 3-mode system:
- Subject Focus: Sharp attention/entropy saliency crop with social media presets
- Face Focus: MediaPipe face detection with headshot framing presets
- Auto Trim: Border removal with optional pad-to-square

Adds detectFaces() to AI package, face preset constants, backward
compatibility for old mode names, and comprehensive integration tests.
This commit is contained in:
Siddharth Kumar Sah
2026-04-13 00:47:53 +08:00
parent 29fafd0722
commit 92d4d2d9c6
9 changed files with 798 additions and 277 deletions
+15 -2
View File
@@ -132,7 +132,7 @@ export const TOOLS: Tool[] = [
{
id: "erase-object",
name: "Object Eraser",
description: "Paint over unwanted elements",
description: "Remove unwanted objects with AI",
category: "ai",
icon: "Wand2",
route: "/erase-object",
@@ -156,7 +156,7 @@ export const TOOLS: Tool[] = [
{
id: "smart-crop",
name: "Smart Crop",
description: "AI detects subject and crops optimally",
description: "Smart subject, face, or trim-based cropping",
category: "ai",
icon: "Focus",
route: "/smart-crop",
@@ -354,6 +354,19 @@ export const SOCIAL_MEDIA_PRESETS: SocialMediaPreset[] = [
{ platform: "Threads", name: "Post Image", width: 1080, height: 1080 },
];
export interface SmartCropFacePreset {
id: string;
label: string;
multiplier: number;
}
export const SMART_CROP_FACE_PRESETS: SmartCropFacePreset[] = [
{ id: "closeup", label: "Close-up", multiplier: 1.8 },
{ id: "head-shoulders", label: "Head & Shoulders", multiplier: 2.8 },
{ id: "upper-body", label: "Upper Body", multiplier: 4.5 },
{ id: "half-body", label: "Half Body", multiplier: 7.0 },
];
export const APP_VERSION = "1.14.0";
/**