@umituz/react-native-ai-generation-content 1.17.228 → 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.
- 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 +234 -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 +228 -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/hooks/README.md +380 -0
- package/src/presentation/hooks/base/use-dual-image-feature.ts +4 -4
- package/src/presentation/hooks/base/use-image-with-prompt-feature.ts +4 -4
- package/src/presentation/hooks/base/utils/feature-state.factory.ts +1 -1
- package/src/presentation/layouts/README.md +374 -0
- package/src/presentation/layouts/types/layout-props.ts +1 -1
- package/src/presentation/screens/README.md +430 -0
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
# Meme Generator
|
|
2
|
+
|
|
3
|
+
Create memes from images with AI-generated text and styling.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Add text to images with smart positioning
|
|
8
|
+
- Multiple meme templates
|
|
9
|
+
- Custom text and captions
|
|
10
|
+
- Auto-generated meme suggestions
|
|
11
|
+
- Style and font customization
|
|
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 { useMemeGeneratorFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
import * as ImagePicker from 'react-native-image-picker';
|
|
28
|
+
|
|
29
|
+
function MemeGeneratorScreen() {
|
|
30
|
+
const [image, setImage] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const feature = useMemeGeneratorFeature({
|
|
33
|
+
config: {
|
|
34
|
+
template: 'classic',
|
|
35
|
+
onProcessingStart: () => console.log('Creating meme...'),
|
|
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
|
+
onSaveResult: 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 for Meme"
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<MemeTemplateSelector
|
|
62
|
+
selectedTemplate={feature.state.template}
|
|
63
|
+
onSelectTemplate={feature.setTemplate}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<TextInput
|
|
67
|
+
placeholder="Top text"
|
|
68
|
+
value={feature.state.topText}
|
|
69
|
+
onChangeText={feature.setTopText}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<TextInput
|
|
73
|
+
placeholder="Bottom text"
|
|
74
|
+
value={feature.state.bottomText}
|
|
75
|
+
onChangeText={feature.setBottomText}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<Button
|
|
79
|
+
title="Create Meme"
|
|
80
|
+
onPress={feature.process}
|
|
81
|
+
disabled={!feature.isReady || feature.state.isProcessing}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
{feature.state.isProcessing && (
|
|
85
|
+
<ActivityIndicator />
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{feature.state.result && (
|
|
89
|
+
<Image source={{ uri: feature.state.result.imageUrl }} />
|
|
90
|
+
)}
|
|
91
|
+
</View>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Using the Unified AI Feature Screen
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
100
|
+
|
|
101
|
+
function App() {
|
|
102
|
+
return (
|
|
103
|
+
<AIFeatureScreen
|
|
104
|
+
featureId="meme-generator"
|
|
105
|
+
userId="user-123"
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Configuration Options
|
|
112
|
+
|
|
113
|
+
### Feature Config
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
interface MemeGeneratorFeatureConfig {
|
|
117
|
+
template?: 'classic' | 'modern' | 'minimal' | 'bold';
|
|
118
|
+
font?: string; // Font family
|
|
119
|
+
fontSize?: number; // Font size
|
|
120
|
+
onProcessingStart?: () => void;
|
|
121
|
+
onProcessingComplete?: (result: MemeGeneratorResult) => void;
|
|
122
|
+
onError?: (error: string) => void;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Generation Options
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
interface MemeGeneratorOptions {
|
|
130
|
+
template: 'classic' | 'modern' | 'minimal' | 'bold';
|
|
131
|
+
topText?: string;
|
|
132
|
+
bottomText?: string;
|
|
133
|
+
fontSize?: number;
|
|
134
|
+
textColor?: string;
|
|
135
|
+
strokeColor?: string;
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Meme Templates
|
|
140
|
+
|
|
141
|
+
### Classic Template
|
|
142
|
+
|
|
143
|
+
Classic top/bottom text meme:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
const result = await feature.process({
|
|
147
|
+
template: 'classic',
|
|
148
|
+
topText: 'WHEN YOU THINK',
|
|
149
|
+
bottomText: 'ABOUT IT',
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Modern Template
|
|
154
|
+
|
|
155
|
+
Modern styling with flexible text placement:
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
const result = await feature.process({
|
|
159
|
+
template: 'modern',
|
|
160
|
+
topText: 'Me: Writes code',
|
|
161
|
+
bottomText: 'Also me: It works on my machine',
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Minimal Template
|
|
166
|
+
|
|
167
|
+
Clean, minimal design:
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
const result = await feature.process({
|
|
171
|
+
template: 'minimal',
|
|
172
|
+
topText: 'Just vibing',
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Bold Template
|
|
177
|
+
|
|
178
|
+
Bold, impactful text:
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
const result = await feature.process({
|
|
182
|
+
template: 'bold',
|
|
183
|
+
topText: 'ERROR 404',
|
|
184
|
+
bottomText: 'MOTIVATION NOT FOUND',
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Usage Flow
|
|
189
|
+
|
|
190
|
+
1. Select **Image** - Choose an image for the meme
|
|
191
|
+
2. Choose **Template** - Select a meme template
|
|
192
|
+
3. Add **Text** - Enter top and/or bottom text
|
|
193
|
+
4. Customize **Style** - Adjust font, size, colors
|
|
194
|
+
5. Tap **Create** - Generate the meme
|
|
195
|
+
6. View Result - See the generated meme
|
|
196
|
+
7. Save or Share - Save or share the meme
|
|
197
|
+
|
|
198
|
+
## Component Examples
|
|
199
|
+
|
|
200
|
+
### Template Selector
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
204
|
+
|
|
205
|
+
const templates = [
|
|
206
|
+
{ id: 'classic', name: 'Classic', description: 'Top/Bottom text' },
|
|
207
|
+
{ id: 'modern', name: 'Modern', description: 'Contemporary style' },
|
|
208
|
+
{ id: 'minimal', name: 'Minimal', description: 'Clean & simple' },
|
|
209
|
+
{ id: 'bold', name: 'Bold', description: 'Big impact' },
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
<GridSelector
|
|
213
|
+
options={templates}
|
|
214
|
+
selectedOption={selectedTemplate}
|
|
215
|
+
onSelectOption={setSelectedTemplate}
|
|
216
|
+
/>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Text Inputs
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
import { TextInput } from 'react-native';
|
|
223
|
+
|
|
224
|
+
<View>
|
|
225
|
+
<TextInput
|
|
226
|
+
placeholder="Top text"
|
|
227
|
+
value={topText}
|
|
228
|
+
onChangeText={setTopText}
|
|
229
|
+
style={{ fontSize: 18, fontWeight: 'bold' }}
|
|
230
|
+
/>
|
|
231
|
+
|
|
232
|
+
<TextInput
|
|
233
|
+
placeholder="Bottom text"
|
|
234
|
+
value={bottomText}
|
|
235
|
+
onChangeText={setBottomText}
|
|
236
|
+
style={{ fontSize: 18, fontWeight: 'bold' }}
|
|
237
|
+
/>
|
|
238
|
+
</View>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Color Picker
|
|
242
|
+
|
|
243
|
+
```tsx
|
|
244
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
245
|
+
|
|
246
|
+
const colors = ['#FFFFFF', '#000000', '#FF0000', '#00FF00', '#0000FF'];
|
|
247
|
+
|
|
248
|
+
<View style={{ flexDirection: 'row' }}>
|
|
249
|
+
{colors.map(color => (
|
|
250
|
+
<TouchableOpacity
|
|
251
|
+
key={color}
|
|
252
|
+
style={{
|
|
253
|
+
width: 40,
|
|
254
|
+
height: 40,
|
|
255
|
+
backgroundColor: color,
|
|
256
|
+
borderRadius: 20,
|
|
257
|
+
margin: 5,
|
|
258
|
+
borderWidth: selectedColor === color ? 3 : 0,
|
|
259
|
+
}}
|
|
260
|
+
onPress={() => setSelectedColor(color)}
|
|
261
|
+
/>
|
|
262
|
+
))}
|
|
263
|
+
</View>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Use Cases
|
|
267
|
+
|
|
268
|
+
### Funny Memes
|
|
269
|
+
|
|
270
|
+
```tsx
|
|
271
|
+
// Create humorous memes
|
|
272
|
+
const result = await feature.process({
|
|
273
|
+
template: 'classic',
|
|
274
|
+
topText: 'Me at 3 AM',
|
|
275
|
+
bottomText: 'Let\'s learn quantum physics',
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Social Media Content
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
// Generate shareable content
|
|
283
|
+
const result = await feature.process({
|
|
284
|
+
template: 'modern',
|
|
285
|
+
topText: 'Monday mood',
|
|
286
|
+
});
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Marketing
|
|
290
|
+
|
|
291
|
+
```tsx
|
|
292
|
+
// Create marketing memes
|
|
293
|
+
const result = await feature.process({
|
|
294
|
+
template: 'bold',
|
|
295
|
+
topText: 'NEW PRODUCT',
|
|
296
|
+
bottomText: '50% OFF',
|
|
297
|
+
});
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Reaction Images
|
|
301
|
+
|
|
302
|
+
```tsx
|
|
303
|
+
// Turn reaction photos into memes
|
|
304
|
+
const result = await feature.process({
|
|
305
|
+
template: 'classic',
|
|
306
|
+
topText: 'When the code works',
|
|
307
|
+
bottomText: 'On the first try',
|
|
308
|
+
});
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Best Practices
|
|
312
|
+
|
|
313
|
+
1. **Text Length**: Keep text short and punchy
|
|
314
|
+
2. **Readability**: Ensure text contrasts well with image
|
|
315
|
+
3. **Font Size**: Adjust based on image size and text length
|
|
316
|
+
4. **Relevance**: Match text to image content
|
|
317
|
+
5. **Humor**: Focus on relatable, funny content
|
|
318
|
+
|
|
319
|
+
## Related Features
|
|
320
|
+
|
|
321
|
+
- [Text to Image](../text-to-image) - Generate images from text
|
|
322
|
+
- [Image to Image](../image-to-image) - Transform images with AI
|
|
323
|
+
- [Style Transfer](../style-transfer) - Apply artistic styles
|
|
324
|
+
|
|
325
|
+
## License
|
|
326
|
+
|
|
327
|
+
MIT
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Photo Restoration
|
|
2
|
+
|
|
3
|
+
Restore and enhance old, blurry, or damaged photos using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Repair old and damaged photographs
|
|
8
|
+
- Remove scratches, tears, and stains
|
|
9
|
+
- Enhance blurry photos
|
|
10
|
+
- Colorize black and white photos
|
|
11
|
+
- Restore facial details and features
|
|
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 { usePhotoRestoreFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
import * as ImagePicker from 'react-native-image-picker';
|
|
28
|
+
|
|
29
|
+
function PhotoRestorationScreen() {
|
|
30
|
+
const [photo, setPhoto] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const feature = usePhotoRestoreFeature({
|
|
33
|
+
config: {
|
|
34
|
+
restorationType: 'auto', // 'auto', ' scratches', 'blur', 'colorize'
|
|
35
|
+
onProcessingStart: () => console.log('Starting restoration...'),
|
|
36
|
+
onProcessingComplete: (result) => console.log('Complete:', result),
|
|
37
|
+
onError: (error) => console.error('Error:', error),
|
|
38
|
+
},
|
|
39
|
+
onSelectPhoto: 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
|
+
setPhoto(base64);
|
|
44
|
+
return base64;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
},
|
|
48
|
+
onSaveResult: async (imageUrl) => {
|
|
49
|
+
await saveToGallery(imageUrl);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View>
|
|
55
|
+
<PhotoUploadCard
|
|
56
|
+
image={photo}
|
|
57
|
+
onSelectImage={feature.selectPhoto}
|
|
58
|
+
title="Select Photo to Restore"
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<Button
|
|
62
|
+
title="Restore Photo"
|
|
63
|
+
onPress={feature.process}
|
|
64
|
+
disabled={!feature.isReady || feature.state.isProcessing}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
{feature.state.isProcessing && (
|
|
68
|
+
<View>
|
|
69
|
+
<Text>Restoring photo...</Text>
|
|
70
|
+
<ProgressBar progress={feature.state.progress} />
|
|
71
|
+
</View>
|
|
72
|
+
)}
|
|
73
|
+
|
|
74
|
+
{feature.state.result && (
|
|
75
|
+
<ResultDisplay
|
|
76
|
+
originalImage={photo}
|
|
77
|
+
resultImage={feature.state.result.imageUrl}
|
|
78
|
+
onSave={() => feature.saveResult()}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Using the Unified AI Feature Screen
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
90
|
+
|
|
91
|
+
function App() {
|
|
92
|
+
return (
|
|
93
|
+
<AIFeatureScreen
|
|
94
|
+
featureId="photo-restoration"
|
|
95
|
+
userId="user-123"
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Configuration Options
|
|
102
|
+
|
|
103
|
+
### Feature Config
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
interface PhotoRestoreFeatureConfig {
|
|
107
|
+
restorationType?: 'auto' | 'scratches' | 'blur' | 'colorize' | 'all';
|
|
108
|
+
onProcessingStart?: () => void;
|
|
109
|
+
onProcessingComplete?: (result: PhotoRestoreResult) => void;
|
|
110
|
+
onError?: (error: string) => void;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Restoration Options
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
interface PhotoRestoreOptions {
|
|
118
|
+
removeScratches?: boolean; // Remove scratches and tears
|
|
119
|
+
fixBlur?: boolean; // Fix blurry photos
|
|
120
|
+
colorize?: boolean; // Colorize black and white photos
|
|
121
|
+
enhanceFaces?: boolean; // Restore facial details
|
|
122
|
+
adjustContrast?: boolean; // Improve contrast and brightness
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Usage Flow
|
|
127
|
+
|
|
128
|
+
1. Select **Photo** - Choose an old or damaged photo
|
|
129
|
+
2. Choose **Restoration Type** - Select what to restore (or use auto)
|
|
130
|
+
3. Tap **Restore** - Start the restoration process
|
|
131
|
+
4. View **Comparison** - See before and after side by side
|
|
132
|
+
5. Save or Share - Save the restored photo
|
|
133
|
+
|
|
134
|
+
## Restoration Types
|
|
135
|
+
|
|
136
|
+
### Auto Restoration
|
|
137
|
+
|
|
138
|
+
Automatically detects and applies appropriate restoration:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
const result = await feature.process({
|
|
142
|
+
restorationType: 'auto',
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Remove Scratches & Tears
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
const result = await feature.process({
|
|
150
|
+
removeScratches: true,
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Fix Blurry Photos
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
const result = await feature.process({
|
|
158
|
+
fixBlur: true,
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Colorize Black & White
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
const result = await feature.process({
|
|
166
|
+
colorize: true,
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Complete Restoration
|
|
171
|
+
|
|
172
|
+
Apply all restoration techniques:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
const result = await feature.process({
|
|
176
|
+
removeScratches: true,
|
|
177
|
+
fixBlur: true,
|
|
178
|
+
colorize: true,
|
|
179
|
+
enhanceFaces: true,
|
|
180
|
+
adjustContrast: true,
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Component Examples
|
|
185
|
+
|
|
186
|
+
### Restoration Type Selector
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
190
|
+
|
|
191
|
+
const restorationTypes = [
|
|
192
|
+
{ id: 'auto', name: 'Auto', description: 'Automatic detection' },
|
|
193
|
+
{ id: 'scratches', name: 'Scratches', description: 'Remove scratches & tears' },
|
|
194
|
+
{ id: 'blur', name: 'Blur', description: 'Fix blurry photos' },
|
|
195
|
+
{ id: 'colorize', name: 'Colorize', description: 'Add color to B&W photos' },
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
function MyScreen() {
|
|
199
|
+
const [restorationType, setRestorationType] = useState('auto');
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<GridSelector
|
|
203
|
+
options={restorationTypes}
|
|
204
|
+
selectedOption={restorationType}
|
|
205
|
+
onSelectOption={setRestorationType}
|
|
206
|
+
/>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Before/After Comparison
|
|
212
|
+
|
|
213
|
+
```tsx
|
|
214
|
+
import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
|
|
215
|
+
|
|
216
|
+
{feature.state.result && photo && (
|
|
217
|
+
<ResultDisplay
|
|
218
|
+
originalImage={photo}
|
|
219
|
+
resultImage={feature.state.result.imageUrl}
|
|
220
|
+
onSave={() => feature.saveResult()}
|
|
221
|
+
onShare={() => shareImage(feature.state.result.imageUrl)}
|
|
222
|
+
/>
|
|
223
|
+
)}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Use Cases
|
|
227
|
+
|
|
228
|
+
### Restoring Old Family Photos
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
// Restore old family photographs
|
|
232
|
+
const result = await feature.process({
|
|
233
|
+
removeScratches: true,
|
|
234
|
+
fixBlur: true,
|
|
235
|
+
adjustContrast: true,
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Colorizing Historical Photos
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
// Add color to black and white photos
|
|
243
|
+
const result = await feature.process({
|
|
244
|
+
colorize: true,
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Fixing Damaged Photos
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
// Repair tears and stains
|
|
252
|
+
const result = await feature.process({
|
|
253
|
+
removeScratches: true,
|
|
254
|
+
});
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Best Practices
|
|
258
|
+
|
|
259
|
+
1. **Scan Quality**: Use high-quality scans for best results
|
|
260
|
+
2. **Start with Auto**: Let AI detect issues first
|
|
261
|
+
3. **Multiple Passes**: Some photos may benefit from multiple restoration passes
|
|
262
|
+
4. **Face Focus**: Enable face enhancement for portrait photos
|
|
263
|
+
5. **Color Accuracy**: Colorization works best with clear reference points
|
|
264
|
+
|
|
265
|
+
## Error Handling
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
const { state, process } = usePhotoRestoreFeature({ ...config });
|
|
269
|
+
|
|
270
|
+
useEffect(() => {
|
|
271
|
+
if (state.error) {
|
|
272
|
+
Alert.alert('Restoration Failed', state.error);
|
|
273
|
+
}
|
|
274
|
+
}, [state.error]);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Related Features
|
|
278
|
+
|
|
279
|
+
- [Upscaling](../upscaling) - Increase image resolution
|
|
280
|
+
- [HD Touch Up](../hd-touch-up) - High-detail enhancements
|
|
281
|
+
- [Colorization](../colorization) - Add color to B&W photos
|
|
282
|
+
- [Face Detection](../../../domains/face-detection) - Face detection API
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
MIT
|