@umituz/react-native-ai-generation-content 1.17.229 → 1.17.231
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.
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/package.json +1 -3
- package/src/domain/README.md +503 -0
- package/src/domains/content-moderation/README.md +363 -0
- package/src/domains/creations/README.md +394 -0
- package/src/domains/face-detection/README.md +395 -0
- package/src/domains/prompts/README.md +387 -0
- package/src/features/ai-hug/README.md +276 -0
- package/src/features/ai-kiss/README.md +276 -0
- package/src/features/anime-selfie/README.md +325 -0
- package/src/features/audio-generation/README.md +370 -0
- package/src/features/colorization/README.md +289 -0
- package/src/features/couple-future/README.md +270 -0
- package/src/features/face-swap/README.md +431 -0
- package/src/features/future-prediction/README.md +281 -0
- package/src/features/hd-touch-up/README.md +309 -0
- package/src/features/image-captioning/README.md +361 -0
- package/src/features/image-to-image/README.md +418 -0
- package/src/features/image-to-video/README.md +369 -0
- package/src/features/inpainting/README.md +302 -0
- package/src/features/meme-generator/README.md +327 -0
- package/src/features/photo-restoration/README.md +286 -0
- package/src/features/remove-background/README.md +292 -0
- package/src/features/remove-object/README.md +352 -0
- package/src/features/replace-background/README.md +288 -0
- package/src/features/script-generator/README.md +362 -0
- package/src/features/shared/README.md +280 -0
- package/src/features/sketch-to-image/README.md +296 -0
- package/src/features/style-transfer/README.md +301 -0
- package/src/features/text-to-image/README.md +394 -0
- package/src/features/text-to-video/README.md +245 -0
- package/src/features/text-to-voice/README.md +335 -0
- package/src/features/upscaling/README.md +247 -0
- package/src/infrastructure/config/README.md +310 -0
- package/src/infrastructure/middleware/README.md +378 -0
- package/src/infrastructure/orchestration/README.md +362 -0
- package/src/infrastructure/services/README.md +382 -0
- package/src/infrastructure/utils/README.md +523 -0
- package/src/infrastructure/wrappers/README.md +336 -0
- package/src/presentation/components/README.md +535 -0
- package/src/presentation/components/result/ResultStoryCard.tsx +1 -6
- package/src/presentation/hooks/README.md +380 -0
- package/src/presentation/layouts/README.md +374 -0
- package/src/presentation/screens/README.md +430 -0
- package/src/presentation/types/result-config.types.ts +3 -3
- package/src/presentation/layouts/types/.npmignore.tmp +0 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
# Image to Video
|
|
2
|
+
|
|
3
|
+
Convert static images into animated videos using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Animate static photos into videos
|
|
8
|
+
- Multiple animation styles (zoom, pan, 3D motion)
|
|
9
|
+
- Support for various durations
|
|
10
|
+
- Natural movement patterns
|
|
11
|
+
- High-quality output
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This feature is part of `@umituz/react-native-ai-generation-content`.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @umituz/react-native-ai-generation-content
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
### Using the Hook
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useImageToVideoFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
import * as ImagePicker from 'react-native-image-picker';
|
|
28
|
+
|
|
29
|
+
function ImageToVideoScreen() {
|
|
30
|
+
const [image, setImage] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const feature = useImageToVideoFeature({
|
|
33
|
+
config: {
|
|
34
|
+
motionType: 'zoom-in',
|
|
35
|
+
duration: 4,
|
|
36
|
+
onProcessingStart: () => console.log('Creating video...'),
|
|
37
|
+
onProcessingComplete: (result) => console.log('Complete:', result),
|
|
38
|
+
onError: (error) => console.error('Error:', error),
|
|
39
|
+
},
|
|
40
|
+
onSelectImage: async () => {
|
|
41
|
+
const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
|
|
42
|
+
if (result.assets && result.assets[0].uri) {
|
|
43
|
+
const base64 = await convertToBase64(result.assets[0].uri);
|
|
44
|
+
setImage(base64);
|
|
45
|
+
return base64;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
onSaveVideo: async (videoUrl) => {
|
|
50
|
+
await saveToGallery(videoUrl);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View>
|
|
56
|
+
<PhotoUploadCard
|
|
57
|
+
image={image}
|
|
58
|
+
onSelectImage={feature.selectImage}
|
|
59
|
+
title="Select Image to Animate"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<MotionTypeSelector
|
|
63
|
+
selectedType={feature.state.motionType}
|
|
64
|
+
onSelectType={feature.setMotionType}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<DurationSelector
|
|
68
|
+
selectedDuration={feature.state.duration}
|
|
69
|
+
onSelectDuration={feature.setDuration}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<Button
|
|
73
|
+
title="Create Video"
|
|
74
|
+
onPress={feature.process}
|
|
75
|
+
disabled={!feature.isReady || feature.state.isProcessing}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
{feature.state.isProcessing && (
|
|
79
|
+
<View>
|
|
80
|
+
<Text>Progress: {feature.state.progress}%</Text>
|
|
81
|
+
<ProgressBar progress={feature.state.progress} />
|
|
82
|
+
</View>
|
|
83
|
+
)}
|
|
84
|
+
|
|
85
|
+
{feature.state.result && (
|
|
86
|
+
<Video source={{ uri: feature.state.result.videoUrl }} />
|
|
87
|
+
)}
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Using the Unified AI Feature Screen
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
97
|
+
|
|
98
|
+
function App() {
|
|
99
|
+
return (
|
|
100
|
+
<AIFeatureScreen
|
|
101
|
+
featureId="image-to-video"
|
|
102
|
+
userId="user-123"
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Configuration Options
|
|
109
|
+
|
|
110
|
+
### Feature Config
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
interface ImageToVideoFeatureConfig {
|
|
114
|
+
motionType?: 'zoom-in' | 'zoom-out' | 'pan-left' | 'pan-right' | '3d';
|
|
115
|
+
duration?: number; // Video duration in seconds (2-8)
|
|
116
|
+
onProcessingStart?: () => void;
|
|
117
|
+
onProcessingComplete?: (result: ImageToVideoResult) => void;
|
|
118
|
+
onError?: (error: string) => void;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Generation Options
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
interface ImageToVideoOptions {
|
|
126
|
+
motionType: 'zoom-in' | 'zoom-out' | 'pan-left' | 'pan-right' | '3d';
|
|
127
|
+
duration: number; // Duration in seconds
|
|
128
|
+
intensity?: number; // Motion intensity 0.0 - 1.0 (default: 0.7)
|
|
129
|
+
fps?: number; // Frames per second (default: 30)
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Motion Types
|
|
134
|
+
|
|
135
|
+
### Zoom In
|
|
136
|
+
|
|
137
|
+
Gradually zoom into the image:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
const result = await feature.process({
|
|
141
|
+
motionType: 'zoom-in',
|
|
142
|
+
duration: 4,
|
|
143
|
+
intensity: 0.7,
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Zoom Out
|
|
148
|
+
|
|
149
|
+
Gradually zoom out from the image:
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
const result = await feature.process({
|
|
153
|
+
motionType: 'zoom-out',
|
|
154
|
+
duration: 5,
|
|
155
|
+
intensity: 0.6,
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Pan Left
|
|
160
|
+
|
|
161
|
+
Pan the image to the left:
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
const result = await feature.process({
|
|
165
|
+
motionType: 'pan-left',
|
|
166
|
+
duration: 4,
|
|
167
|
+
intensity: 0.7,
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Pan Right
|
|
172
|
+
|
|
173
|
+
Pan the image to the right:
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
const result = await feature.process({
|
|
177
|
+
motionType: 'pan-right',
|
|
178
|
+
duration: 4,
|
|
179
|
+
intensity: 0.7,
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 3D Motion
|
|
184
|
+
|
|
185
|
+
Add depth with 3D parallax effect:
|
|
186
|
+
|
|
187
|
+
```tsx
|
|
188
|
+
const result = await feature.process({
|
|
189
|
+
motionType: '3d',
|
|
190
|
+
duration: 5,
|
|
191
|
+
intensity: 0.8,
|
|
192
|
+
});
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Usage Flow
|
|
196
|
+
|
|
197
|
+
1. Select **Image** - Choose a static image to animate
|
|
198
|
+
2. Choose **Motion Type** - Select the animation style
|
|
199
|
+
3. Set **Duration** - Choose video length
|
|
200
|
+
4. Tap **Create Video** - Start the animation
|
|
201
|
+
5. View Result - Watch the generated video
|
|
202
|
+
6. Save or Share - Save to gallery or share
|
|
203
|
+
|
|
204
|
+
## Component Examples
|
|
205
|
+
|
|
206
|
+
### Motion Type Selector
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import { StylePresetsGrid } from '@umituz/react-native-ai-generation-content';
|
|
210
|
+
|
|
211
|
+
const motionTypes = [
|
|
212
|
+
{ id: 'zoom-in', name: 'Zoom In', preview: '...' },
|
|
213
|
+
{ id: 'zoom-out', name: 'Zoom Out', preview: '...' },
|
|
214
|
+
{ id: 'pan-left', name: 'Pan Left', preview: '...' },
|
|
215
|
+
{ id: 'pan-right', name: 'Pan Right', preview: '...' },
|
|
216
|
+
{ id: '3d', name: '3D Motion', preview: '...' },
|
|
217
|
+
];
|
|
218
|
+
|
|
219
|
+
<StylePresetsGrid
|
|
220
|
+
styles={motionTypes}
|
|
221
|
+
selectedStyle={selectedMotionType}
|
|
222
|
+
onSelectStyle={setSelectedMotionType}
|
|
223
|
+
/>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Duration Selector
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
import { DurationSelector, createDurationOptions } from '@umituz/react-native-ai-generation-content';
|
|
230
|
+
|
|
231
|
+
const durations = createDurationOptions([2, 3, 4, 5, 6, 7, 8]);
|
|
232
|
+
|
|
233
|
+
<DurationSelector
|
|
234
|
+
selectedDuration={duration}
|
|
235
|
+
onSelectDuration={setDuration}
|
|
236
|
+
durations={durations}
|
|
237
|
+
/>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Intensity Slider
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import { Slider } from 'react-native';
|
|
244
|
+
|
|
245
|
+
<Slider
|
|
246
|
+
minimumValue={0}
|
|
247
|
+
maximumValue={1}
|
|
248
|
+
step={0.1}
|
|
249
|
+
value={intensity}
|
|
250
|
+
onValueChange={setIntensity}
|
|
251
|
+
/>
|
|
252
|
+
|
|
253
|
+
<Text>Motion Intensity: {Math.round(intensity * 100)}%</Text>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Advanced Usage
|
|
257
|
+
|
|
258
|
+
### Custom Options
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
const result = await feature.process({
|
|
262
|
+
motionType: '3d',
|
|
263
|
+
duration: 6,
|
|
264
|
+
intensity: 0.8,
|
|
265
|
+
fps: 30,
|
|
266
|
+
});
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Progress Stages
|
|
270
|
+
|
|
271
|
+
```tsx
|
|
272
|
+
const { state } = useImageToVideoFeature({ ...config });
|
|
273
|
+
|
|
274
|
+
// Progress stages:
|
|
275
|
+
// - Analyzing image (0-20%)
|
|
276
|
+
// - Generating motion (20-60%)
|
|
277
|
+
// - Rendering frames (60-90%)
|
|
278
|
+
// - Finalizing video (90-100%)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Video Preview
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
import { Video } from 'expo-av';
|
|
285
|
+
import { useRef } from 'react';
|
|
286
|
+
|
|
287
|
+
const videoRef = useRef<Video>(null);
|
|
288
|
+
|
|
289
|
+
<Video
|
|
290
|
+
ref={videoRef}
|
|
291
|
+
source={{ uri: feature.state.result.videoUrl }}
|
|
292
|
+
useNativeControls
|
|
293
|
+
resizeMode="contain"
|
|
294
|
+
style={{ width: '100%', height: 300 }}
|
|
295
|
+
/>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Use Cases
|
|
299
|
+
|
|
300
|
+
### Social Media Content
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
// Create animated posts
|
|
304
|
+
const result = await feature.process({
|
|
305
|
+
motionType: 'zoom-in',
|
|
306
|
+
duration: 4,
|
|
307
|
+
});
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Photo Slideshows
|
|
311
|
+
|
|
312
|
+
```tsx
|
|
313
|
+
// Animate photos for slideshows
|
|
314
|
+
const result = await feature.process({
|
|
315
|
+
motionType: 'pan-right',
|
|
316
|
+
duration: 5,
|
|
317
|
+
});
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Product Showcases
|
|
321
|
+
|
|
322
|
+
```tsx
|
|
323
|
+
// Create dynamic product videos
|
|
324
|
+
const result = await feature.process({
|
|
325
|
+
motionType: '3d',
|
|
326
|
+
duration: 6,
|
|
327
|
+
intensity: 0.8,
|
|
328
|
+
});
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Storytelling
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
// Add motion to story images
|
|
335
|
+
const result = await feature.process({
|
|
336
|
+
motionType: 'zoom-out',
|
|
337
|
+
duration: 5,
|
|
338
|
+
});
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
## Best Practices
|
|
342
|
+
|
|
343
|
+
1. **Image Quality**: Use high-resolution images for best results
|
|
344
|
+
2. **Subject Focus**: Choose motion that highlights the main subject
|
|
345
|
+
3. **Duration**: Shorter durations (3-5s) work well for social media
|
|
346
|
+
4. **Intensity**: Moderate intensity (0.6-0.8) produces natural motion
|
|
347
|
+
5. **Testing**: Try different motion types to find the best fit
|
|
348
|
+
|
|
349
|
+
## Error Handling
|
|
350
|
+
|
|
351
|
+
```tsx
|
|
352
|
+
const { state, process } = useImageToVideoFeature({ ...config });
|
|
353
|
+
|
|
354
|
+
useEffect(() => {
|
|
355
|
+
if (state.error) {
|
|
356
|
+
Alert.alert('Generation Failed', state.error);
|
|
357
|
+
}
|
|
358
|
+
}, [state.error]);
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Related Features
|
|
362
|
+
|
|
363
|
+
- [Text to Video](../text-to-video) - Generate videos from text
|
|
364
|
+
- [Text to Image](../text-to-image) - Generate images from text
|
|
365
|
+
- [Upscaling](../upscaling) - Increase image resolution before video creation
|
|
366
|
+
|
|
367
|
+
## License
|
|
368
|
+
|
|
369
|
+
MIT
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# Inpainting
|
|
2
|
+
|
|
3
|
+
Fill in missing or hidden parts of images using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Fill in missing areas of images
|
|
8
|
+
- Remove unwanted objects seamlessly
|
|
9
|
+
- Extend image boundaries
|
|
10
|
+
- Smart content-aware fill
|
|
11
|
+
- Natural-looking reconstruction
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
This feature is part of `@umituz/react-native-ai-generation-content`.
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @umituz/react-native-ai-generation-content
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Basic Usage
|
|
22
|
+
|
|
23
|
+
### Using the Hook
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { useInpaintingFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
import * as ImagePicker from 'react-native-image-picker';
|
|
28
|
+
|
|
29
|
+
function InpaintingScreen() {
|
|
30
|
+
const [image, setImage] = useState<string | null>(null);
|
|
31
|
+
const [mask, setMask] = useState<string | null>(null);
|
|
32
|
+
|
|
33
|
+
const feature = useInpaintingFeature({
|
|
34
|
+
config: {
|
|
35
|
+
fillMethod: 'smart',
|
|
36
|
+
onProcessingStart: () => console.log('Filling area...'),
|
|
37
|
+
onProcessingComplete: (result) => console.log('Complete:', result),
|
|
38
|
+
onError: (error) => console.error('Error:', error),
|
|
39
|
+
},
|
|
40
|
+
onSelectImage: async () => {
|
|
41
|
+
const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
|
|
42
|
+
if (result.assets && result.assets[0].uri) {
|
|
43
|
+
const base64 = await convertToBase64(result.assets[0].uri);
|
|
44
|
+
setImage(base64);
|
|
45
|
+
return base64;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
onCreateMask: async () => {
|
|
50
|
+
// User paints over the area to fill
|
|
51
|
+
const maskImage = await paintMaskOverImage(image);
|
|
52
|
+
setMask(maskImage);
|
|
53
|
+
return maskImage;
|
|
54
|
+
},
|
|
55
|
+
onSaveResult: async (imageUrl) => {
|
|
56
|
+
await saveToGallery(imageUrl);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<View>
|
|
62
|
+
<PhotoUploadCard
|
|
63
|
+
image={image}
|
|
64
|
+
onSelectImage={feature.selectImage}
|
|
65
|
+
title="Select Image"
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
<MaskEditor
|
|
69
|
+
image={image}
|
|
70
|
+
mask={mask}
|
|
71
|
+
onMaskCreated={feature.createMask}
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<FillMethodSelector
|
|
75
|
+
selectedMethod={feature.state.fillMethod}
|
|
76
|
+
onSelectMethod={feature.setFillMethod}
|
|
77
|
+
/>
|
|
78
|
+
|
|
79
|
+
<Button
|
|
80
|
+
title="Fill Area"
|
|
81
|
+
onPress={feature.process}
|
|
82
|
+
disabled={!feature.isReady || feature.state.isProcessing}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
{feature.state.isProcessing && (
|
|
86
|
+
<ActivityIndicator />
|
|
87
|
+
)}
|
|
88
|
+
|
|
89
|
+
{feature.state.result && (
|
|
90
|
+
<ResultDisplay
|
|
91
|
+
originalImage={image}
|
|
92
|
+
resultImage={feature.state.result.imageUrl}
|
|
93
|
+
onSave={() => feature.saveResult()}
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
</View>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Using the Unified AI Feature Screen
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
105
|
+
|
|
106
|
+
function App() {
|
|
107
|
+
return (
|
|
108
|
+
<AIFeatureScreen
|
|
109
|
+
featureId="inpainting"
|
|
110
|
+
userId="user-123"
|
|
111
|
+
/>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Configuration Options
|
|
117
|
+
|
|
118
|
+
### Feature Config
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
interface InpaintingFeatureConfig {
|
|
122
|
+
fillMethod?: 'smart' | 'contextual' | 'pattern';
|
|
123
|
+
onProcessingStart?: () => void;
|
|
124
|
+
onProcessingComplete?: (result: InpaintingResult) => void;
|
|
125
|
+
onError?: (error: string) => void;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Processing Options
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
interface InpaintingOptions {
|
|
133
|
+
mask: string; // Base64 mask of area to fill
|
|
134
|
+
fillMethod: 'smart' | 'contextual' | 'pattern';
|
|
135
|
+
preserveContext?: boolean; // Maintain surrounding context (default: true)
|
|
136
|
+
blendEdges?: boolean; // Blend filled area with surroundings (default: true)
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Fill Methods
|
|
141
|
+
|
|
142
|
+
### Smart Fill
|
|
143
|
+
|
|
144
|
+
AI-powered intelligent reconstruction:
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
const result = await feature.process({
|
|
148
|
+
mask: maskImage,
|
|
149
|
+
fillMethod: 'smart',
|
|
150
|
+
preserveContext: true,
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Contextual Fill
|
|
155
|
+
|
|
156
|
+
Fill based on surrounding content:
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
const result = await feature.process({
|
|
160
|
+
mask: maskImage,
|
|
161
|
+
fillMethod: 'contextual',
|
|
162
|
+
blendEdges: true,
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Pattern Fill
|
|
167
|
+
|
|
168
|
+
Fill with detected patterns:
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
const result = await feature.process({
|
|
172
|
+
mask: maskImage,
|
|
173
|
+
fillMethod: 'pattern',
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Usage Flow
|
|
178
|
+
|
|
179
|
+
1. Select **Image** - Choose an image with missing or unwanted areas
|
|
180
|
+
2. Create **Mask** - Paint over the area to fill
|
|
181
|
+
3. Choose **Fill Method** - Select the fill strategy
|
|
182
|
+
4. Tap **Fill** - Start the inpainting process
|
|
183
|
+
5. View **Result** - See the filled image
|
|
184
|
+
6. Save or Adjust - Save or make further adjustments
|
|
185
|
+
|
|
186
|
+
## Component Examples
|
|
187
|
+
|
|
188
|
+
### Fill Method Selector
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
192
|
+
|
|
193
|
+
const fillMethods = [
|
|
194
|
+
{ id: 'smart', name: 'Smart Fill', description: 'AI reconstruction' },
|
|
195
|
+
{ id: 'contextual', name: 'Contextual', description: 'Based on surroundings' },
|
|
196
|
+
{ id: 'pattern', name: 'Pattern', description: 'Pattern matching' },
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
<GridSelector
|
|
200
|
+
options={fillMethods}
|
|
201
|
+
selectedOption={selectedMethod}
|
|
202
|
+
onSelectOption={setSelectedMethod}
|
|
203
|
+
/>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Mask Editor
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import { View, Image } from 'react-native';
|
|
210
|
+
|
|
211
|
+
function MaskEditor({ image, mask, onMaskCreated }) {
|
|
212
|
+
return (
|
|
213
|
+
<View style={{ position: 'relative' }}>
|
|
214
|
+
<Image source={{ uri: image }} style={{ width: 300, height: 300 }} />
|
|
215
|
+
{mask && (
|
|
216
|
+
<Image
|
|
217
|
+
source={{ uri: mask }}
|
|
218
|
+
style={{ width: 300, height: 300, position: 'absolute', opacity: 0.5 }}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
<Button title="Paint Mask" onPress={onMaskCreated} />
|
|
222
|
+
</View>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Before/After Comparison
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
|
|
231
|
+
|
|
232
|
+
{feature.state.result && image && (
|
|
233
|
+
<ResultDisplay
|
|
234
|
+
originalImage={image}
|
|
235
|
+
resultImage={feature.state.result.imageUrl}
|
|
236
|
+
onSave={() => feature.saveResult()}
|
|
237
|
+
onShare={() => shareImage(feature.state.result.imageUrl)}
|
|
238
|
+
/>
|
|
239
|
+
)}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Use Cases
|
|
243
|
+
|
|
244
|
+
### Remove Objects
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
// Remove unwanted objects
|
|
248
|
+
const result = await feature.process({
|
|
249
|
+
mask: objectMask,
|
|
250
|
+
fillMethod: 'smart',
|
|
251
|
+
});
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Repair Damaged Photos
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
// Fix tears or damaged areas
|
|
258
|
+
const result = await feature.process({
|
|
259
|
+
mask: damageMask,
|
|
260
|
+
fillMethod: 'contextual',
|
|
261
|
+
blendEdges: true,
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Extend Image
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
// Expand image boundaries
|
|
269
|
+
const result = await feature.process({
|
|
270
|
+
mask: extensionMask,
|
|
271
|
+
fillMethod: 'smart',
|
|
272
|
+
});
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Fill Missing Parts
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
// Complete missing elements
|
|
279
|
+
const result = await feature.process({
|
|
280
|
+
mask: missingPartMask,
|
|
281
|
+
fillMethod: 'smart',
|
|
282
|
+
preserveContext: true,
|
|
283
|
+
});
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Best Practices
|
|
287
|
+
|
|
288
|
+
1. **Mask Precision**: Paint carefully around the edges
|
|
289
|
+
2. **Fill Method**: Use Smart Fill for most cases
|
|
290
|
+
3. **Context Preservation**: Enable for natural results
|
|
291
|
+
4. **Multiple Tries**: May need multiple attempts for complex areas
|
|
292
|
+
5. **Edge Blending**: Enable for seamless integration
|
|
293
|
+
|
|
294
|
+
## Related Features
|
|
295
|
+
|
|
296
|
+
- [Remove Object](../remove-object) - Remove unwanted objects
|
|
297
|
+
- [Remove Background](../remove-background) - Remove backgrounds
|
|
298
|
+
- [Photo Restoration](../photo-restoration) - Restore old photos
|
|
299
|
+
|
|
300
|
+
## License
|
|
301
|
+
|
|
302
|
+
MIT
|