@umituz/react-native-ai-generation-content 1.17.229 → 1.17.230

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +346 -0
  3. package/package.json +1 -3
  4. package/src/domain/README.md +503 -0
  5. package/src/domains/content-moderation/README.md +363 -0
  6. package/src/domains/creations/README.md +394 -0
  7. package/src/domains/face-detection/README.md +395 -0
  8. package/src/domains/prompts/README.md +387 -0
  9. package/src/features/ai-hug/README.md +276 -0
  10. package/src/features/ai-kiss/README.md +276 -0
  11. package/src/features/anime-selfie/README.md +325 -0
  12. package/src/features/audio-generation/README.md +370 -0
  13. package/src/features/colorization/README.md +289 -0
  14. package/src/features/couple-future/README.md +270 -0
  15. package/src/features/face-swap/README.md +234 -0
  16. package/src/features/future-prediction/README.md +281 -0
  17. package/src/features/hd-touch-up/README.md +309 -0
  18. package/src/features/image-captioning/README.md +361 -0
  19. package/src/features/image-to-image/README.md +418 -0
  20. package/src/features/image-to-video/README.md +369 -0
  21. package/src/features/inpainting/README.md +302 -0
  22. package/src/features/meme-generator/README.md +327 -0
  23. package/src/features/photo-restoration/README.md +286 -0
  24. package/src/features/remove-background/README.md +292 -0
  25. package/src/features/remove-object/README.md +352 -0
  26. package/src/features/replace-background/README.md +288 -0
  27. package/src/features/script-generator/README.md +362 -0
  28. package/src/features/shared/README.md +280 -0
  29. package/src/features/sketch-to-image/README.md +296 -0
  30. package/src/features/style-transfer/README.md +301 -0
  31. package/src/features/text-to-image/README.md +228 -0
  32. package/src/features/text-to-video/README.md +245 -0
  33. package/src/features/text-to-voice/README.md +335 -0
  34. package/src/features/upscaling/README.md +247 -0
  35. package/src/infrastructure/config/README.md +310 -0
  36. package/src/infrastructure/middleware/README.md +378 -0
  37. package/src/infrastructure/orchestration/README.md +362 -0
  38. package/src/infrastructure/services/README.md +382 -0
  39. package/src/infrastructure/utils/README.md +523 -0
  40. package/src/infrastructure/wrappers/README.md +336 -0
  41. package/src/presentation/components/README.md +535 -0
  42. package/src/presentation/hooks/README.md +380 -0
  43. package/src/presentation/layouts/README.md +374 -0
  44. package/src/presentation/screens/README.md +430 -0
  45. package/src/presentation/layouts/types/.npmignore.tmp +0 -0
@@ -0,0 +1,292 @@
1
+ # Remove Background
2
+
3
+ Remove backgrounds from images using AI with precision.
4
+
5
+ ## Features
6
+
7
+ - Automatic background detection and removal
8
+ - Keep main subject while removing background
9
+ - Support for complex subjects (hair, fur, transparent objects)
10
+ - Fine-tune edges for professional results
11
+ - Export as transparent PNG
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 { useRemoveBackgroundFeature } from '@umituz/react-native-ai-generation-content';
27
+ import * as ImagePicker from 'react-native-image-picker';
28
+
29
+ function RemoveBackgroundScreen() {
30
+ const [image, setImage] = useState<string | null>(null);
31
+
32
+ const feature = useRemoveBackgroundFeature({
33
+ config: {
34
+ edgeSmoothness: 'medium',
35
+ onProcessingStart: () => console.log('Removing background...'),
36
+ onProcessingComplete: (result) => console.log('Complete:', result),
37
+ onError: (error) => console.error('Error:', error),
38
+ },
39
+ onSelectImage: async () => {
40
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
41
+ if (result.assets && result.assets[0].uri) {
42
+ const base64 = await convertToBase64(result.assets[0].uri);
43
+ setImage(base64);
44
+ return base64;
45
+ }
46
+ return null;
47
+ },
48
+ onSaveImage: async (imageUrl) => {
49
+ await saveToGallery(imageUrl);
50
+ },
51
+ });
52
+
53
+ return (
54
+ <View>
55
+ <PhotoUploadCard
56
+ image={image}
57
+ onSelectImage={feature.selectImage}
58
+ title="Select Image to Remove Background"
59
+ />
60
+
61
+ <Button
62
+ title="Remove Background"
63
+ onPress={feature.process}
64
+ disabled={!feature.isReady || feature.state.isProcessing}
65
+ />
66
+
67
+ {feature.state.isProcessing && (
68
+ <ActivityIndicator />
69
+ )}
70
+
71
+ {feature.state.result && (
72
+ <ResultDisplay
73
+ originalImage={image}
74
+ resultImage={feature.state.result.imageUrl}
75
+ onSave={() => feature.saveResult()}
76
+ showTransparentBackground
77
+ />
78
+ )}
79
+ </View>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ### Using the Unified AI Feature Screen
85
+
86
+ ```tsx
87
+ import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
88
+
89
+ function App() {
90
+ return (
91
+ <AIFeatureScreen
92
+ featureId="remove-background"
93
+ userId="user-123"
94
+ />
95
+ );
96
+ }
97
+ ```
98
+
99
+ ## Configuration Options
100
+
101
+ ### Feature Config
102
+
103
+ ```tsx
104
+ interface RemoveBackgroundFeatureConfig {
105
+ edgeSmoothness?: 'low' | 'medium' | 'high';
106
+ returnMask?: boolean; // Return the mask along with result
107
+ onProcessingStart?: () => void;
108
+ onProcessingComplete?: (result: RemoveBackgroundResult) => void;
109
+ onError?: (error: string) => void;
110
+ }
111
+ ```
112
+
113
+ ### Processing Options
114
+
115
+ ```tsx
116
+ interface RemoveBackgroundOptions {
117
+ edgeSmoothness: 'low' | 'medium' | 'high';
118
+ featherEdges?: boolean; // Soften edges for natural look
119
+ preserveHair?: boolean; // Better hair detection (default: true)
120
+ backgroundColor?: string; // Add new background color
121
+ }
122
+ ```
123
+
124
+ ## Usage Flow
125
+
126
+ 1. Select **Image** - Choose an image with background to remove
127
+ 2. Configure **Options** - Adjust edge smoothness and other settings
128
+ 3. Tap **Remove Background** - Start the removal process
129
+ 4. View **Result** - See the image with transparent background
130
+ 5. Save or Edit - Save as PNG or add new background
131
+
132
+ ## Component Examples
133
+
134
+ ### Edge Smoothness Selector
135
+
136
+ ```tsx
137
+ import { GridSelector } from '@umituz/react-native-ai-generation-content';
138
+
139
+ const smoothnessOptions = [
140
+ { id: 'low', name: 'Sharp', description: 'Precise edges' },
141
+ { id: 'medium', name: 'Balanced', description: 'Natural edges' },
142
+ { id: 'high', name: 'Smooth', description: 'Soft edges' },
143
+ ];
144
+
145
+ function MyScreen() {
146
+ const [smoothness, setSmoothness] = useState('medium');
147
+
148
+ return (
149
+ <GridSelector
150
+ options={smoothnessOptions}
151
+ selectedOption={smoothness}
152
+ onSelectOption={setSmoothness}
153
+ />
154
+ );
155
+ }
156
+ ```
157
+
158
+ ### Background Preview
159
+
160
+ ```tsx
161
+ import { View, Image } from 'react-native';
162
+
163
+ const previewBackgrounds = [
164
+ { color: '#FFFFFF', name: 'White' },
165
+ { color: '#000000', name: 'Black' },
166
+ { color: '#F0F0F0', name: 'Gray' },
167
+ { color: 'transparent', name: 'Transparent' },
168
+ ];
169
+
170
+ function BackgroundPreview({ imageUrl }) {
171
+ const [background, setBackground] = useState('transparent');
172
+
173
+ return (
174
+ <View style={{ backgroundColor: background }}>
175
+ <Image
176
+ source={{ uri: imageUrl }}
177
+ style={{ width: 300, height: 300 }}
178
+ />
179
+ </View>
180
+ );
181
+ }
182
+ ```
183
+
184
+ ### Before/After Comparison
185
+
186
+ ```tsx
187
+ import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
188
+
189
+ {feature.state.result && image && (
190
+ <ResultDisplay
191
+ originalImage={image}
192
+ resultImage={feature.state.result.imageUrl}
193
+ onSave={() => feature.saveResult()}
194
+ onShare={() => shareImage(feature.state.result.imageUrl)}
195
+ />
196
+ )}
197
+ ```
198
+
199
+ ## Advanced Usage
200
+
201
+ ### Custom Edge Smoothness
202
+
203
+ ```tsx
204
+ const result = await feature.process({
205
+ edgeSmoothness: 'high',
206
+ featherEdges: true,
207
+ preserveHair: true,
208
+ });
209
+ ```
210
+
211
+ ### Add New Background
212
+
213
+ ```tsx
214
+ // After removing background, add a new one
215
+ const result = await feature.process({
216
+ edgeSmoothness: 'medium',
217
+ backgroundColor: '#FF5733', // Orange background
218
+ });
219
+ ```
220
+
221
+ ### Export with Mask
222
+
223
+ ```tsx
224
+ const result = await feature.process({
225
+ edgeSmoothness: 'medium',
226
+ returnMask: true,
227
+ });
228
+
229
+ // result.maskUrl contains the segmentation mask
230
+ ```
231
+
232
+ ## Use Cases
233
+
234
+ ### Product Photos
235
+
236
+ ```tsx
237
+ // Remove background for e-commerce product photos
238
+ const result = await feature.process({
239
+ edgeSmoothness: 'high',
240
+ preserveHair: false,
241
+ });
242
+ ```
243
+
244
+ ### Profile Pictures
245
+
246
+ ```tsx
247
+ // Create clean profile pictures
248
+ const result = await feature.process({
249
+ edgeSmoothness: 'medium',
250
+ featherEdges: true,
251
+ });
252
+ ```
253
+
254
+ ### Graphic Design
255
+
256
+ ```tsx
257
+ // Extract subjects for design work
258
+ const result = await feature.process({
259
+ edgeSmoothness: 'low',
260
+ returnMask: true,
261
+ });
262
+ ```
263
+
264
+ ## Best Practices
265
+
266
+ 1. **Image Quality**: Use high-resolution images for best results
267
+ 2. **Subject Separation**: Ensure subject is clearly separated from background
268
+ 3. **Edge Smoothness**: Adjust based on subject type (high for hair, low for objects)
269
+ 4. **Hair/Fur**: Enable hair preservation for better results
270
+ 5. **Lighting**: Even lighting produces better edge detection
271
+
272
+ ## Error Handling
273
+
274
+ ```tsx
275
+ const { state, process } = useRemoveBackgroundFeature({ ...config });
276
+
277
+ useEffect(() => {
278
+ if (state.error) {
279
+ Alert.alert('Removal Failed', state.error);
280
+ }
281
+ }, [state.error]);
282
+ ```
283
+
284
+ ## Related Features
285
+
286
+ - [Replace Background](../replace-background) - Replace with new background
287
+ - [Remove Object](../remove-object) - Remove unwanted objects
288
+ - [Image to Image](../image-to-image) - Transform images with AI
289
+
290
+ ## License
291
+
292
+ MIT
@@ -0,0 +1,352 @@
1
+ # Remove Object
2
+
3
+ Remove unwanted objects from images using AI.
4
+
5
+ ## Features
6
+
7
+ - Remove any unwanted object from photos
8
+ - Automatic background reconstruction
9
+ - Smart fill to maintain image quality
10
+ - Support for multiple objects
11
+ - Natural-looking results
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 { useRemoveObjectFeature } from '@umituz/react-native-ai-generation-content';
27
+ import * as ImagePicker from 'react-native-image-picker';
28
+
29
+ function RemoveObjectScreen() {
30
+ const [image, setImage] = useState<string | null>(null);
31
+ const [mask, setMask] = useState<string | null>(null);
32
+
33
+ const feature = useRemoveObjectFeature({
34
+ config: {
35
+ onProcessingStart: () => console.log('Removing object...'),
36
+ onProcessingComplete: (result) => console.log('Complete:', result),
37
+ onError: (error) => console.error('Error:', error),
38
+ },
39
+ onSelectImage: async () => {
40
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
41
+ if (result.assets && result.assets[0].uri) {
42
+ const base64 = await convertToBase64(result.assets[0].uri);
43
+ setImage(base64);
44
+ return base64;
45
+ }
46
+ return null;
47
+ },
48
+ onCreateMask: async () => {
49
+ // User paints over the object to remove
50
+ const maskImage = await paintMaskOverImage(image);
51
+ setMask(maskImage);
52
+ return maskImage;
53
+ },
54
+ onSaveResult: async (imageUrl) => {
55
+ await saveToGallery(imageUrl);
56
+ },
57
+ });
58
+
59
+ return (
60
+ <View>
61
+ <PhotoUploadCard
62
+ image={image}
63
+ onSelectImage={feature.selectImage}
64
+ title="Select Image with Object to Remove"
65
+ />
66
+
67
+ <MaskEditor
68
+ image={image}
69
+ mask={mask}
70
+ onMaskCreated={feature.createMask}
71
+ />
72
+
73
+ <Button
74
+ title="Remove Object"
75
+ onPress={feature.process}
76
+ disabled={!feature.isReady || feature.state.isProcessing}
77
+ />
78
+
79
+ {feature.state.isProcessing && (
80
+ <View>
81
+ <Text>Removing object...</Text>
82
+ <ProgressBar progress={feature.state.progress} />
83
+ </View>
84
+ )}
85
+
86
+ {feature.state.result && (
87
+ <ResultDisplay
88
+ originalImage={image}
89
+ resultImage={feature.state.result.imageUrl}
90
+ onSave={() => feature.saveResult()}
91
+ />
92
+ )}
93
+ </View>
94
+ );
95
+ }
96
+ ```
97
+
98
+ ### Using the Unified AI Feature Screen
99
+
100
+ ```tsx
101
+ import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
102
+
103
+ function App() {
104
+ return (
105
+ <AIFeatureScreen
106
+ featureId="remove-object"
107
+ userId="user-123"
108
+ />
109
+ );
110
+ }
111
+ ```
112
+
113
+ ## Configuration Options
114
+
115
+ ### Feature Config
116
+
117
+ ```tsx
118
+ interface RemoveObjectFeatureConfig {
119
+ fillMethod?: 'smart' | 'blur' | 'color'; // How to fill the removed area
120
+ onProcessingStart?: () => void;
121
+ onProcessingComplete?: (result: RemoveObjectResult) => void;
122
+ onError?: (error: string) => void;
123
+ }
124
+ ```
125
+
126
+ ### Processing Options
127
+
128
+ ```tsx
129
+ interface RemoveObjectOptions {
130
+ mask: string; // Base64 mask indicating the object to remove
131
+ fillMethod: 'smart' | 'blur' | 'color';
132
+ featherEdges?: boolean; // Soften edges for natural look (default: true)
133
+ preserveContext?: boolean; // Maintain surrounding context (default: true)
134
+ }
135
+ ```
136
+
137
+ ## Fill Methods
138
+
139
+ ### Smart Fill
140
+
141
+ AI-powered intelligent reconstruction:
142
+
143
+ ```tsx
144
+ const result = await feature.process({
145
+ mask: maskImage,
146
+ fillMethod: 'smart',
147
+ preserveContext: true,
148
+ });
149
+ ```
150
+
151
+ ### Blur Fill
152
+
153
+ Blur and blend surrounding area:
154
+
155
+ ```tsx
156
+ const result = await feature.process({
157
+ mask: maskImage,
158
+ fillMethod: 'blur',
159
+ featherEdges: true,
160
+ });
161
+ ```
162
+
163
+ ### Color Fill
164
+
165
+ Fill with average surrounding color:
166
+
167
+ ```tsx
168
+ const result = await feature.process({
169
+ mask: maskImage,
170
+ fillMethod: 'color',
171
+ featherEdges: true,
172
+ });
173
+ ```
174
+
175
+ ## Usage Flow
176
+
177
+ 1. Select **Image** - Choose an image with unwanted objects
178
+ 2. Create **Mask** - Paint over the objects to remove
179
+ 3. Choose **Fill Method** - Select how to fill the removed area
180
+ 4. Tap **Remove** - Start the removal process
181
+ 5. View Result - See the cleaned image
182
+ 6. Save or Edit - Save or make further adjustments
183
+
184
+ ## Component Examples
185
+
186
+ ### Fill Method Selector
187
+
188
+ ```tsx
189
+ import { GridSelector } from '@umituz/react-native-ai-generation-content';
190
+
191
+ const fillMethods = [
192
+ { id: 'smart', name: 'Smart Fill', description: 'AI reconstruction' },
193
+ { id: 'blur', name: 'Blur', description: 'Blurred fill' },
194
+ { id: 'color', name: 'Color', description: 'Solid color fill' },
195
+ ];
196
+
197
+ <GridSelector
198
+ options={fillMethods}
199
+ selectedOption={selectedMethod}
200
+ onSelectOption={setSelectedMethod}
201
+ />
202
+ ```
203
+
204
+ ### Mask Editor
205
+
206
+ ```tsx
207
+ import { View, Image } from 'react-native';
208
+ import { GestureHandlerRootView, GestureDetector } from 'react-native-gesture-handler';
209
+
210
+ function MaskEditor({ image, mask, onMaskCreated }) {
211
+ const [isDrawing, setIsDrawing] = useState(false);
212
+
213
+ const handleDraw = (gestureEvent) => {
214
+ // Implement drawing logic
215
+ // Update mask as user draws
216
+ };
217
+
218
+ return (
219
+ <GestureDetector onGestureEvent={handleDraw}>
220
+ <View style={{ position: 'relative' }}>
221
+ <Image source={{ uri: image }} style={{ width: 300, height: 300 }} />
222
+ {mask && (
223
+ <Image
224
+ source={{ uri: mask }}
225
+ style={{ width: 300, height: 300, position: 'absolute' }}
226
+ />
227
+ )}
228
+ </View>
229
+ </GestureDetector>
230
+ );
231
+ }
232
+ ```
233
+
234
+ ### Before/After Comparison
235
+
236
+ ```tsx
237
+ import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
238
+
239
+ {feature.state.result && image && (
240
+ <ResultDisplay
241
+ originalImage={image}
242
+ resultImage={feature.state.result.imageUrl}
243
+ onSave={() => feature.saveResult()}
244
+ onShare={() => shareImage(feature.state.result.imageUrl)}
245
+ />
246
+ )}
247
+ ```
248
+
249
+ ## Use Cases
250
+
251
+ ### Remove Photobombers
252
+
253
+ ```tsx
254
+ // Remove unwanted people from photos
255
+ const result = await feature.process({
256
+ mask: photobomberMask,
257
+ fillMethod: 'smart',
258
+ });
259
+ ```
260
+
261
+ ### Clean Up Backgrounds
262
+
263
+ ```tsx
264
+ // Remove distracting elements
265
+ const result = await feature.process({
266
+ mask: objectMask,
267
+ fillMethod: 'smart',
268
+ preserveContext: true,
269
+ });
270
+ ```
271
+
272
+ ### Remove Text & Watermarks
273
+
274
+ ```tsx
275
+ // Remove unwanted text or logos
276
+ const result = await feature.process({
277
+ mask: textMask,
278
+ fillMethod: 'blur',
279
+ featherEdges: true,
280
+ });
281
+ ```
282
+
283
+ ### Remove Objects from Nature
284
+
285
+ ```tsx
286
+ // Remove trash, signs, etc. from nature photos
287
+ const result = await feature.process({
288
+ mask: objectMask,
289
+ fillMethod: 'smart',
290
+ });
291
+ ```
292
+
293
+ ## Best Practices
294
+
295
+ 1. **Mask Precision**: Paint carefully over the object edges
296
+ 2. **Fill Method**: Use Smart Fill for most natural results
297
+ 4. **Simple Backgrounds**: Easier removal from simple backgrounds
298
+ 5. **Context Preservation**: Enable for objects near important elements
299
+ 6. **Multiple Passes**: For difficult objects, try multiple approaches
300
+
301
+ ## Advanced Usage
302
+
303
+ ### Multiple Objects
304
+
305
+ ```tsx
306
+ // Create mask covering all objects to remove
307
+ const combinedMask = combineMasks([mask1, mask2, mask3]);
308
+ const result = await feature.process({
309
+ mask: combinedMask,
310
+ fillMethod: 'smart',
311
+ });
312
+ ```
313
+
314
+ ### Iterative Refinement
315
+
316
+ ```tsx
317
+ // Remove object, then adjust if needed
318
+ let result = await feature.process({
319
+ mask: initialMask,
320
+ fillMethod: 'smart',
321
+ });
322
+
323
+ if (!result.success || needsRefinement) {
324
+ const refinedMask = refineMask(initialMask);
325
+ result = await feature.process({
326
+ mask: refinedMask,
327
+ fillMethod: 'smart',
328
+ });
329
+ }
330
+ ```
331
+
332
+ ## Error Handling
333
+
334
+ ```tsx
335
+ const { state, process } = useRemoveObjectFeature({ ...config });
336
+
337
+ useEffect(() => {
338
+ if (state.error) {
339
+ Alert.alert('Removal Failed', state.error);
340
+ }
341
+ }, [state.error]);
342
+ ```
343
+
344
+ ## Related Features
345
+
346
+ - [Remove Background](../remove-background) - Remove entire backgrounds
347
+ - [Inpainting](../inpainting) - Fill in missing parts of images
348
+ - [Replace Background](../replace-background) - Replace with new background
349
+
350
+ ## License
351
+
352
+ MIT