@umituz/react-native-ai-generation-content 1.17.231 → 1.17.233

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.
Files changed (31) hide show
  1. package/README.md +236 -261
  2. package/package.json +1 -1
  3. package/src/domains/content-moderation/README.md +239 -296
  4. package/src/domains/creations/README.md +242 -325
  5. package/src/domains/face-detection/README.md +228 -307
  6. package/src/domains/prompts/README.md +242 -312
  7. package/src/features/ai-hug/README.md +381 -219
  8. package/src/features/ai-kiss/README.md +388 -219
  9. package/src/features/anime-selfie/README.md +327 -256
  10. package/src/features/audio-generation/README.md +352 -309
  11. package/src/features/colorization/README.md +332 -228
  12. package/src/features/couple-future/README.md +387 -212
  13. package/src/features/future-prediction/README.md +391 -221
  14. package/src/features/hd-touch-up/README.md +339 -252
  15. package/src/features/image-captioning/README.md +359 -299
  16. package/src/features/image-to-image/README.md +398 -357
  17. package/src/features/image-to-video/README.md +337 -292
  18. package/src/features/inpainting/README.md +348 -244
  19. package/src/features/meme-generator/README.md +350 -269
  20. package/src/features/photo-restoration/README.md +338 -225
  21. package/src/features/remove-background/README.md +335 -234
  22. package/src/features/remove-object/README.md +341 -288
  23. package/src/features/replace-background/README.md +353 -236
  24. package/src/features/script-generator/README.md +358 -287
  25. package/src/features/shared/README.md +254 -223
  26. package/src/features/sketch-to-image/README.md +331 -234
  27. package/src/features/style-transfer/README.md +336 -237
  28. package/src/features/text-to-video/README.md +360 -193
  29. package/src/features/text-to-voice/README.md +382 -272
  30. package/src/features/upscaling/README.md +340 -191
  31. package/src/presentation/components/result/ResultStoryCard.tsx +1 -1
@@ -1,302 +1,406 @@
1
- # Inpainting
1
+ # Inpainting Feature
2
2
 
3
3
  Fill in missing or hidden parts of images using AI.
4
4
 
5
- ## Features
5
+ ## 📍 Import Path
6
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
7
+ ```typescript
8
+ import { useInpaintingFeature } from '@umituz/react-native-ai-generation-content';
9
+ ```
12
10
 
13
- ## Installation
11
+ **Location**: `src/features/inpainting/`
14
12
 
15
- This feature is part of `@umituz/react-native-ai-generation-content`.
13
+ ## 🎯 Feature Purpose
16
14
 
17
- ```bash
18
- npm install @umituz/react-native-ai-generation-content
19
- ```
15
+ Intelligently fill in missing areas, remove unwanted objects, or extend image boundaries using AI-powered content-aware fill. Supports smart reconstruction, contextual filling, and pattern matching for natural-looking results.
20
16
 
21
- ## Basic Usage
17
+ ---
22
18
 
23
- ### Using the Hook
19
+ ## 📋 Usage Strategy
24
20
 
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
- ```
21
+ ### When to Use This Feature
100
22
 
101
- ### Using the Unified AI Feature Screen
23
+ **Use Cases:**
24
+ - Removing unwanted objects from photos
25
+ - Repairing damaged or torn areas
26
+ - Extending image boundaries
27
+ - Filling in missing parts of images
28
+ - Cleaning up sensor dust or scratches
102
29
 
103
- ```tsx
104
- import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
30
+ ❌ **When NOT to Use:**
31
+ - Simple background removal (use Remove Background)
32
+ - General object removal without precise masking (use Remove Object)
33
+ - Photo restoration (use Photo Restoration)
34
+ - Adding new elements not present in image
35
+
36
+ ### Implementation Strategy
37
+
38
+ 1. **Select image** with missing or unwanted areas
39
+ 2. **Create mask** by painting over areas to fill
40
+ 3. **Choose fill method** (smart, contextual, pattern)
41
+ 4. **Configure options** (edge blending, context preservation)
42
+ 5. **Process inpainting** with progress tracking
43
+ 6. **Preview and compare** with original
44
+ 7. **Save or adjust** result
45
+
46
+ ---
47
+
48
+ ## ⚠️ Critical Rules (MUST FOLLOW)
49
+
50
+ ### 1. Image Requirements
51
+ - **MUST** provide ONE image to inpaint
52
+ - **MUST** use high-quality images (min 512x512 recommended)
53
+ - **MUST** have clear areas to fill
54
+ - **MUST NOT** exceed file size limits (10MB max)
55
+ - **MUST** create accurate mask for areas to fill
56
+
57
+ ### 2. Mask Requirements
58
+ - **MUST** provide valid mask image
59
+ - **MUST** paint mask carefully over areas to fill
60
+ - **MUST** ensure mask covers entire area to inpaint
61
+ - **MUST** include mask creation interface
62
+ - **MUST** validate mask before processing
63
+
64
+ ### 3. Configuration
65
+ - **MUST** provide valid `userId` for tracking
66
+ - **MUST** specify `fillMethod` (smart, contextual, pattern)
67
+ - **MUST** implement `onError` callback
68
+ - **MUST** implement `onSelectImage` callback
69
+ - **MUST** implement `onCreateMask` callback
70
+
71
+ ### 4. State Management
72
+ - **MUST** check `isReady` before enabling fill button
73
+ - **MUST** verify both image and mask are provided
74
+ - **MUST** display progress during inpainting
75
+ - **MUST** display `error` state with clear messages
76
+ - **MUST** implement proper cleanup on unmount
77
+
78
+ ### 5. Performance
79
+ - **MUST** implement image compression before upload
80
+ - **MUST** show progress indicator for processing
81
+ - **MUST** cache results locally
82
+ - **MUST** allow users to cancel processing
83
+ - **MUST NOT** inpaint multiple areas simultaneously
84
+
85
+ ---
86
+
87
+ ## 🚫 Prohibitions (MUST AVOID)
88
+
89
+ ### Strictly Forbidden
90
+
91
+ ❌ **NEVER** do the following:
92
+
93
+ 1. **No Missing Mask**
94
+ - Always validate mask is created
95
+ - Never call process() without mask
96
+
97
+ 2. **No Auto-Processing**
98
+ - Never start inpainting without user action
99
+ - Always require explicit "Fill" button press
100
+ - Show mask preview before processing
101
+
102
+ 3. **No Hardcoded Credentials**
103
+ - Never store API keys in component files
104
+ - Use environment variables or secure storage
105
+
106
+ 4. **No Unhandled Errors**
107
+ - Never ignore inpainting failures
108
+ - Always explain what went wrong
109
+ - Provide retry or alternative options
110
+
111
+ 5. **No Memory Leaks**
112
+ - Never store both original and result simultaneously
113
+ - Clean up temporary mask images
114
+ - Implement proper image disposal
115
+
116
+ 6. **No Blocked UI**
117
+ - Never block main thread with mask processing
118
+ - Always show progress indicator
119
+ - Allow cancellation
120
+
121
+ 7. **No Imprecise Masking**
122
+ - Never use rough or inaccurate masks
123
+ - Always provide tools for precise mask creation
124
+ - Allow mask adjustment before processing
125
+
126
+ ---
127
+
128
+ ## 🤖 AI Agent Directions
129
+
130
+ ### For AI Code Generation Tools
131
+
132
+ When using this feature with AI code generation tools, follow these guidelines:
133
+
134
+ #### Prompt Template for AI Agents
105
135
 
106
- function App() {
107
- return (
108
- <AIFeatureScreen
109
- featureId="inpainting"
110
- userId="user-123"
111
- />
112
- );
113
- }
114
136
  ```
137
+ You are implementing an inpainting feature using @umituz/react-native-ai-generation-content.
138
+
139
+ REQUIREMENTS:
140
+ 1. Import from: @umituz/react-native-ai-generation-content
141
+ 2. Use the useInpaintingFeature hook
142
+ 3. Implement image selection UI
143
+ 4. Implement mask creation UI with drawing tools
144
+ 5. Select fill method (smart, contextual, pattern)
145
+ 6. Configure options (preserveContext, blendEdges)
146
+ 7. Validate both image and mask before processing
147
+ 8. Show before/after comparison
148
+ 9. Handle long processing times with progress
149
+ 10. Implement proper error handling
150
+ 11. Implement cleanup on unmount
151
+
152
+ CRITICAL RULES:
153
+ - MUST validate both image and mask before calling process()
154
+ - MUST provide mask drawing/creation interface
155
+ - MUST show before/after comparison
156
+ - MUST handle fill method selection
157
+ - MUST implement debouncing (300ms)
158
+ - MUST allow multiple inpainting attempts
159
+
160
+ CONFIGURATION:
161
+ - Provide valid userId (string)
162
+ - Set fillMethod: 'smart' | 'contextual' | 'pattern'
163
+ - Set preserveContext: boolean (maintain surroundings)
164
+ - Set blendEdges: boolean (seamless integration)
165
+ - Implement onSelectImage callback
166
+ - Implement onCreateMask callback
167
+ - Implement onSaveResult callback
168
+ - Configure callbacks: onProcessingStart, onProcessingComplete, onError
169
+
170
+ FILL METHODS:
171
+ - smart: AI-powered intelligent reconstruction
172
+ - contextual: Fill based on surrounding content
173
+ - pattern: Fill with detected patterns
174
+
175
+ OPTIONS:
176
+ - preserveContext: Maintain surrounding context (default: true)
177
+ - blendEdges: Blend filled area with surroundings (default: true)
178
+
179
+ STRICTLY FORBIDDEN:
180
+ - No missing mask validation
181
+ - No auto-processing without user action
182
+ - No hardcoded API keys
183
+ - No unhandled errors
184
+ - No memory leaks
185
+ - No blocking UI
186
+ - No imprecise masking
187
+
188
+ QUALITY CHECKLIST:
189
+ - [ ] Image selection implemented
190
+ - [ ] Mask creation/drawing interface added
191
+ - [ ] Fill method selector included
192
+ - [ ] Mask validation before processing
193
+ - [ ] Before/after comparison view
194
+ - [ ] Progress indicator during processing
195
+ - [ ] Error display with retry option
196
+ - [ ] Download/share functionality
197
+ - [ ] Multiple inpainting attempts supported
198
+ ```
199
+
200
+ #### AI Implementation Checklist
201
+
202
+ Use this checklist when generating code:
203
+
204
+ - [ ] Feature imported from correct path
205
+ - [ ] Image selection implemented
206
+ - [ ] Mask drawing interface implemented
207
+ - [ ] Fill method selector added
208
+ - [ ] Validation before process() (image + mask)
209
+ - [ ] Before/after comparison view
210
+ - [ ] Progress indicator during processing
211
+ - [ ] Error display with user-friendly message
212
+ - [ ] Download/share buttons
213
+ - [ ] Multiple inpainting attempts option
214
+ - [ ] Cleanup on unmount
215
+ - [ ] Original image preserved
115
216
 
116
- ## Configuration Options
217
+ ---
117
218
 
118
- ### Feature Config
219
+ ## 🛠️ Configuration Strategy
119
220
 
120
- ```tsx
121
- interface InpaintingFeatureConfig {
122
- fillMethod?: 'smart' | 'contextual' | 'pattern';
123
- onProcessingStart?: () => void;
124
- onProcessingComplete?: (result: InpaintingResult) => void;
125
- onError?: (error: string) => void;
221
+ ### Essential Configuration
222
+
223
+ ```typescript
224
+ // Required fields
225
+ {
226
+ userId: string
227
+ fillMethod: 'smart' | 'contextual' | 'pattern'
228
+ onSelectImage: () => Promise<string | null>
229
+ onCreateMask: () => Promise<string | null>
230
+ }
231
+
232
+ // Optional callbacks
233
+ {
234
+ onProcessingStart?: () => void
235
+ onProcessingComplete?: (result) => void
236
+ onError?: (error: string) => void
126
237
  }
127
238
  ```
128
239
 
129
- ### Processing Options
240
+ ### Recommended Settings
241
+
242
+ 1. **Fill Methods**
243
+ - Smart: AI-powered intelligent reconstruction (recommended for most cases)
244
+ - Contextual: Fill based on surrounding content (good for consistent backgrounds)
245
+ - Pattern: Fill with detected patterns (good for repeating elements)
246
+
247
+ 2. **Options**
248
+ - preserveContext: Maintain surrounding context (default: true)
249
+ - blendEdges: Blend filled area seamlessly (default: true)
250
+
251
+ 3. **Image Quality**
252
+ - Minimum: 512x512 resolution
253
+ - Recommended: 1024x1024 or higher
254
+ - Format: JPEG or PNG
255
+ - Max size: 10MB
256
+
257
+ 4. **Mask Quality**
258
+ - Precise masking around edges
259
+ - Complete coverage of area to fill
260
+ - Semi-transparent for preview
261
+
262
+ ---
263
+
264
+ ## 📊 State Management
265
+
266
+ ### Feature States
267
+
268
+ **isReady**: boolean
269
+ - Image selected and mask created
270
+ - Check before enabling fill button
271
+
272
+ **isProcessing**: boolean
273
+ - Inpainting in progress
274
+ - Show loading/progress indicator
275
+ - Disable fill button
130
276
 
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)
277
+ **progress**: number (0-100)
278
+ - Inpainting progress percentage
279
+ - Update progress bar
280
+
281
+ **error**: string | null
282
+ - Error message if inpainting failed
283
+ - Display to user with clear message
284
+
285
+ **result**: {
286
+ imageUrl: string
287
+ originalImageUrl?: string
288
+ fillMethod?: string
289
+ metadata?: any
137
290
  }
138
- ```
139
291
 
140
- ## Fill Methods
292
+ ---
141
293
 
142
- ### Smart Fill
294
+ ## 🎨 Best Practices
143
295
 
144
- AI-powered intelligent reconstruction:
296
+ ### Mask Creation
145
297
 
146
- ```tsx
147
- const result = await feature.process({
148
- mask: maskImage,
149
- fillMethod: 'smart',
150
- preserveContext: true,
151
- });
152
- ```
298
+ 1. **Precision**
299
+ - Good: Carefully painted edges around area
300
+ - Bad: Rough, imprecise masking
153
301
 
154
- ### Contextual Fill
302
+ 2. **Coverage**
303
+ - Ensure mask covers entire area to fill
304
+ - Include some surrounding context
305
+ - Avoid leaving gaps
155
306
 
156
- Fill based on surrounding content:
307
+ 3. **Fill Method Selection**
308
+ - Use Smart Fill for most cases
309
+ - Use Contextual for consistent backgrounds
310
+ - Use Pattern for repeating elements
157
311
 
158
- ```tsx
159
- const result = await feature.process({
160
- mask: maskImage,
161
- fillMethod: 'contextual',
162
- blendEdges: true,
163
- });
164
- ```
312
+ ### User Experience
165
313
 
166
- ### Pattern Fill
314
+ 1. **Mask Drawing Tools**
315
+ - Brush size adjustment
316
+ - Eraser for corrections
317
+ - Undo/redo support
318
+ - Zoom for precision
167
319
 
168
- Fill with detected patterns:
320
+ 2. **Preview**
321
+ - Show mask overlay before processing
322
+ - Allow mask adjustments
323
+ - Preview fill method settings
169
324
 
170
- ```tsx
171
- const result = await feature.process({
172
- mask: maskImage,
173
- fillMethod: 'pattern',
174
- });
175
- ```
325
+ 3. **Before/After Comparison**
326
+ - Side-by-side comparison
327
+ - Slider for easy comparison
328
+ - Zoom for detail inspection
176
329
 
177
- ## Usage Flow
330
+ ---
178
331
 
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
332
+ ## 🐛 Common Pitfalls
185
333
 
186
- ## Component Examples
334
+ ### Mask Issues
187
335
 
188
- ### Fill Method Selector
336
+ **Problem**: Poor inpainting results
337
+ ✅ **Solution**: Use precise mask, try different fill method
189
338
 
190
- ```tsx
191
- import { GridSelector } from '@umituz/react-native-ai-generation-content';
339
+ ### Edge Issues
192
340
 
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
- ];
341
+ **Problem**: Visible edges around filled area
342
+ **Solution**: Enable blendEdges, improve mask precision
198
343
 
199
- <GridSelector
200
- options={fillMethods}
201
- selectedOption={selectedMethod}
202
- onSelectOption={setSelectedMethod}
203
- />
204
- ```
344
+ ### Performance Issues
205
345
 
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
- ```
346
+ **Problem**: Slow inpainting
347
+ ✅ **Solution**: Compress images, show progress, allow cancellation
226
348
 
227
- ### Before/After Comparison
349
+ ### Selection Issues
228
350
 
229
- ```tsx
230
- import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
351
+ ❌ **Problem**: Wrong fill method for content
352
+ **Solution**: Try different fill method, adjust context preservation
231
353
 
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
- ```
354
+ ---
241
355
 
242
- ## Use Cases
356
+ ## 📦 Related Components
243
357
 
244
- ### Remove Objects
358
+ Use these components from the library:
245
359
 
246
- ```tsx
247
- // Remove unwanted objects
248
- const result = await feature.process({
249
- mask: objectMask,
250
- fillMethod: 'smart',
251
- });
252
- ```
360
+ - **PhotoUploadCard**: Upload image interface
361
+ - **MaskEditor**: Create mask with drawing tools
362
+ - **FillMethodSelector**: Choose fill strategy
363
+ - **ResultDisplay**: Before/after comparison
364
+ - **ProgressBar**: Progress display
253
365
 
254
- ### Repair Damaged Photos
366
+ Located at: `src/presentation/components/`
255
367
 
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
- ```
368
+ ---
264
369
 
265
- ### Extend Image
370
+ ## 🔄 Migration Strategy
266
371
 
267
- ```tsx
268
- // Expand image boundaries
269
- const result = await feature.process({
270
- mask: extensionMask,
271
- fillMethod: 'smart',
272
- });
273
- ```
372
+ If migrating from previous implementation:
274
373
 
275
- ### Fill Missing Parts
374
+ 1. **Update imports** to new path
375
+ 2. **Add mask creation interface**
376
+ 3. **Implement fill method selector**
377
+ 4. **Update state handling** for new structure
378
+ 5. **Add before/after comparison**
379
+ 6. **Test all fill methods**
276
380
 
277
- ```tsx
278
- // Complete missing elements
279
- const result = await feature.process({
280
- mask: missingPartMask,
281
- fillMethod: 'smart',
282
- preserveContext: true,
283
- });
284
- ```
381
+ ---
382
+
383
+ ## 📚 Additional Resources
384
+
385
+ - Main documentation: `/docs/`
386
+ - API reference: `/docs/api/`
387
+ - Examples: `/docs/examples/basic/inpainting/`
388
+ - Architecture: `/ARCHITECTURE.md`
285
389
 
286
- ## Best Practices
390
+ ---
287
391
 
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
392
+ **Last Updated**: 2025-01-08
393
+ **Version**: 2.0.0 (Strategy-based Documentation)
293
394
 
294
- ## Related Features
395
+ ---
295
396
 
296
- - [Remove Object](../remove-object) - Remove unwanted objects
297
- - [Remove Background](../remove-background) - Remove backgrounds
298
- - [Photo Restoration](../photo-restoration) - Restore old photos
397
+ ## 📝 Changelog
299
398
 
300
- ## License
399
+ ### v2.0.0 - 2025-01-08
400
+ - **BREAKING**: Documentation format changed to strategy-based
401
+ - Removed extensive code examples
402
+ - Added rules, prohibitions, and AI agent directions
403
+ - Focus on best practices and implementation guidance
301
404
 
302
- MIT
405
+ ### v1.0.0 - Initial Release
406
+ - Initial feature documentation