Inpaint Canvas
Маска для инпейнтинга и расширение холста. Pro · Изображения и генерация › Результаты и правка
Установка
npx valyro-cli@latest login
npx valyro-cli@latest add inpaint-canvas
npm install valyro-ui-pro
import 'valyro-ui-pro/styles.css';
import { InpaintCanvas } from 'valyro-ui-pro';
Пропсы
| Prop | Type | Default | |
|---|---|---|---|
src | string | Image URL (needs CORS for export when cross-origin). Without it a procedural image is painted from prompt + seed. | |
prompt | string | '' | Prompt the procedural stand-in is painted from when there is no src. |
seed | number | 0 | Seed of the procedural stand-in. |
width * | number | Working size of the image in pixels. | |
height * | number | Working height of the image in pixels; the mask is exported at this size (plus any extension). | |
tool | 'brush' | 'eraser' | 'rectangle' | 'lasso' | 'pan' | Controlled tool; use with onToolChange. | |
defaultTool | 'brush' | 'eraser' | 'rectangle' | 'lasso' | 'pan' | 'brush' | Initial tool when uncontrolled. |
onToolChange | (tool: InpaintTool) => void | Called with the new tool when it changes. | |
brush | InpaintBrush | Controlled brush; use with onBrushChange. | |
defaultBrush | Partial<InpaintBrush> | Initial brush when uncontrolled. | |
onBrushChange | (brush: InpaintBrush) => void | Called with the new brush when it changes. | |
maskColor | string | Controlled maskColor; use with onMaskColorChange. | |
defaultMaskColor | string | Initial maskColor when uncontrolled. | |
onMaskColorChange | (color: string) => void | Called with the new maskColor when it changes. | |
maskColors | readonly InpaintMaskColor[] | DEFAULT_MASK_COLORS | Swatches for the mask overlay color; the first is the initial color when none is given. |
overlayOpacity | number | 0.55 | Opacity of the mask overlay. Default 0.55. |
outpaint | boolean | true | Edge handles that extend the canvas. Default true. |
extent | Extent | Controlled extent; use with onExtentChange. | |
defaultExtent | Extent | NO_EXTENT | Initial extent when uncontrolled. |
onExtentChange | (extent: Extent) => void | Called with the new extent when it changes. | |
extendStep | number | 64 | Snap of the extension. Default 64. |
maxExtend | number | 512 | Largest extension per side. Default 512. |
initialMask | string | Mask to start from, as an image URL (a saved mask or a data URL): white is regenerated, black is kept. Painted once for each image, scaled to it; needs CORS when cross-origin. Undo doesn't go before it. | |
onMaskChange | (info: { empty: boolean }) => void | Called after every committed edit: whether anything is masked or extended. | |
apiRef | Ref<InpaintCanvasApi> | Receives the canvas handle: export the image and mask as PNGs, undo / redo, clear, invert, fit, isEmpty. | |
actions | ReactNode | Extra controls at the end of the toolbar, e.g. a Generate button. | |
stageHeight | number | string | Height of the drawing area. By default clamp(320px, 60vh, 620px), but never taller than the image needs at the current width (so a phone shows no empty band around it). | |
locale | string | BCP 47 locale for numbers and dates; defaults to the ThemeProvider's, then the browser's. | |
labels | Partial<InpaintCanvasLabels> | Overrides for the built-in English text; keys left out keep their defaults. |
Похожие компоненты
- Generation Progress — Шаги, ETA, живое латентное превью, очередь
- Image Result Grid — Галерея результатов, действия и лайтбокс
- Image Compare — Сравнение до/после: шторка, рядом, наложение
- Generation History — История генераций по дням с фильтрами
- Image Adjustments — Цветокоррекция: загрузка, вписывание и семь ползунков с фильтром
- Prompt Editor — Промпт и негатив: веса, LoRA, автодополнение, токены
- Generation Settings — Модель, сэмплер, шаги, CFG, размер, пресеты
- Aspect Ratio Picker — Соотношение сторон и точный размер
- Seed Input — Сид: случайный, фиксированный, инкремент
- LoRA Stack — Стек LoRA: силы, переключатели, порядок, триггеры
- Style Presets — Карточки стилей с превью и весами
- Reference Image Input — Референс для img2img и ControlNet
Назад: Image Compare · Далее: Generation History · Весь раздел «Изображения и генерация»