jatui

SmartImageEditor

AI image upload with background removal and multi-variant processing

Simple mode (no spec)

Without a spec prop, SmartImageEditor behaves like a plain upload zone. The picked file is forwarded as a blob URL via onComplete.

Editor mode (with spec)

Pass an ImageProcessingSpec with variants to unlock AI background-removal and per-variant tile grid. Each variant is uploaded independently via uploadEndpoint. This mode requires a server-side image processing route — not demoed here to avoid network calls.

<SmartImageEditor
  spec={{
    bgRemoval: true,
    variants: [
      { name: 'original', label: 'Original', width: 800, height: 600 },
      { name: 'thumb',    label: 'Thumbnail', width: 200, height: 150 },
      { name: 'avatar',  label: 'Avatar', width: 200, height: 200 }
    ]
  }}
  uploadEndpoint="/api/admin/image/process"
  previewUrls={{ original: existingUrl }}
  onComplete={(variants) => saveUrls(variants)}
  onDelete={(name) => deleteVariant(name)}
/>

Props

PropTypeDefaultDescription
valuestring""Simple-mode output URL (bindable)
specImageProcessingSpec-Variant spec — enables editor mode with AI pipeline
uploadEndpointstring"/api/admin/image/process"Server route that accepts the file and spec
previewUrlsRecord<string, string>-Pre-populate variant tiles with existing stored URLs
acceptstring"image/png,image/jpeg,…"Accepted MIME types
maxSizeMbnumber10Max file size in MB
onComplete(variants: VariantResult[]) => void-Called when all variants are processed
onDelete(variantName) => Promise<boolean>-Called when user deletes a variant tile
onDirectUpload(name, file) => Promise<VariantResult>-Per-tile direct upload bypass for the AI pipeline