feat: curseur tolérance verre pour récupérer les zones semi-transparentes du détourage

Ajoute alphaThreshold (défaut 30) — les pixels dont l'alpha dépasse ce seuil
sont rendus opaques avant la composition sur fond blanc, évitant que le verre
ou les surfaces translucides soient supprimés par le modèle IA.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 11:28:42 +02:00
parent c1fad5d0ed
commit d45c9490c0
5 changed files with 53 additions and 14 deletions
+16 -1
View File
@@ -5,6 +5,7 @@ import type { ImageItem } from '@/types/images'
interface ImageCardProps {
item: ImageItem
onFeatherChange: (id: string, value: number) => void
onAlphaThresholdChange: (id: string, value: number) => void
onRotate: (id: string, direction: 'cw' | 'ccw') => void
onUpload: (id: string) => void
onRemove: (id: string) => void
@@ -94,6 +95,7 @@ function ProductSearch({ itemId, onAssign }: { itemId: string; onAssign: (id: st
export function ImageCard({
item,
onFeatherChange,
onAlphaThresholdChange,
onRotate,
onUpload,
onRemove,
@@ -148,7 +150,7 @@ export function ImageCard({
<ProductSearch itemId={item.id} onAssign={onAssignProduct} />
)}
{/* Contrôles feather + rotation */}
{/* Contrôles feather + tolérance + rotation */}
<div className={canAdjust ? '' : 'opacity-40 pointer-events-none'}>
<label className="block text-xs text-slate-500 mb-1">
Bords : {item.feather} px
@@ -163,6 +165,19 @@ export function ImageCard({
className="w-full accent-indigo-500"
/>
<label className="block text-xs text-slate-500 mb-1 mt-2">
Tolérance verre : {item.alphaThreshold}
</label>
<input
type="range"
min={0}
max={100}
step={5}
value={item.alphaThreshold}
onChange={(e) => onAlphaThresholdChange(item.id, Number(e.target.value))}
className="w-full accent-amber-500"
/>
<div className="flex gap-1 mt-2">
<button
onClick={() => onRotate(item.id, 'ccw')}