@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.
- 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/layouts/README.md +374 -0
- package/src/presentation/screens/README.md +430 -0
- package/src/presentation/layouts/types/.npmignore.tmp +0 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
# Audio Generation
|
|
2
|
+
|
|
3
|
+
Generate audio content using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Generate various audio content types
|
|
8
|
+
- Music generation
|
|
9
|
+
- Sound effects creation
|
|
10
|
+
- Voice narration
|
|
11
|
+
- Customizable parameters
|
|
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 { useAudioGeneration } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
|
|
28
|
+
function AudioGenerationScreen() {
|
|
29
|
+
const [prompt, setPrompt] = useState('');
|
|
30
|
+
|
|
31
|
+
const feature = useAudioGeneration({
|
|
32
|
+
config: {
|
|
33
|
+
audioType: 'music',
|
|
34
|
+
duration: 30, // seconds
|
|
35
|
+
onProcessingStart: () => console.log('Generating audio...'),
|
|
36
|
+
onProcessingComplete: (result) => console.log('Complete:', result),
|
|
37
|
+
onError: (error) => console.error('Error:', error),
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const playAudio = async () => {
|
|
42
|
+
if (feature.state.audioUrl) {
|
|
43
|
+
const { sound } = await Audio.Sound.createAsync(
|
|
44
|
+
{ uri: feature.state.audioUrl },
|
|
45
|
+
{ shouldPlay: true }
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View>
|
|
52
|
+
<TextInput
|
|
53
|
+
placeholder="Describe the audio you want to generate..."
|
|
54
|
+
value={prompt}
|
|
55
|
+
onChangeText={setPrompt}
|
|
56
|
+
multiline
|
|
57
|
+
numberOfLines={4}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
<AudioTypeSelector
|
|
61
|
+
selectedType={feature.state.audioType}
|
|
62
|
+
onSelectType={feature.setAudioType}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<DurationSlider
|
|
66
|
+
value={feature.state.duration}
|
|
67
|
+
onChange={feature.setDuration}
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<Button
|
|
71
|
+
title="Generate Audio"
|
|
72
|
+
onPress={() => feature.generate(prompt)}
|
|
73
|
+
disabled={!prompt || feature.state.isProcessing}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
{feature.state.isProcessing && (
|
|
77
|
+
<ActivityIndicator />
|
|
78
|
+
)}
|
|
79
|
+
|
|
80
|
+
{feature.state.audioUrl && (
|
|
81
|
+
<View>
|
|
82
|
+
<Button title="Play Audio" onPress={playAudio} />
|
|
83
|
+
<Button title="Save Audio" onPress={() => feature.saveAudio()} />
|
|
84
|
+
</View>
|
|
85
|
+
)}
|
|
86
|
+
</View>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Using the Unified AI Feature Screen
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
95
|
+
|
|
96
|
+
function App() {
|
|
97
|
+
return (
|
|
98
|
+
<AIFeatureScreen
|
|
99
|
+
featureId="audio-generation"
|
|
100
|
+
userId="user-123"
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Configuration Options
|
|
107
|
+
|
|
108
|
+
### Feature Config
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
interface AudioGenerationFeatureConfig {
|
|
112
|
+
audioType?: 'music' | 'sfx' | 'ambient' | 'voice';
|
|
113
|
+
duration?: number; // Duration in seconds
|
|
114
|
+
genre?: string; // Music genre (for music type)
|
|
115
|
+
mood?: string; // Audio mood
|
|
116
|
+
onProcessingStart?: () => void;
|
|
117
|
+
onProcessingComplete?: (result: AudioGenerationResult) => void;
|
|
118
|
+
onError?: (error: string) => void;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Generation Options
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
interface AudioGenerationOptions {
|
|
126
|
+
audioType: 'music' | 'sfx' | 'ambient' | 'voice';
|
|
127
|
+
prompt: string; // Description of desired audio
|
|
128
|
+
duration: number; // Duration in seconds
|
|
129
|
+
genre?: string; // e.g., 'rock', 'jazz', 'electronic'
|
|
130
|
+
mood?: string; // e.g., 'happy', 'sad', 'energetic'
|
|
131
|
+
tempo?: number; // BPM for music (default: 120)
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Audio Types
|
|
136
|
+
|
|
137
|
+
### Music
|
|
138
|
+
|
|
139
|
+
Generate musical compositions:
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
const result = await feature.generate('Upbeat background music', {
|
|
143
|
+
audioType: 'music',
|
|
144
|
+
genre: 'pop',
|
|
145
|
+
mood: 'happy',
|
|
146
|
+
tempo: 120,
|
|
147
|
+
duration: 30,
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Sound Effects
|
|
152
|
+
|
|
153
|
+
Generate sound effects:
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
const result = await feature.generate('Explosion sound', {
|
|
157
|
+
audioType: 'sfx',
|
|
158
|
+
duration: 5,
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Ambient
|
|
163
|
+
|
|
164
|
+
Generate ambient/background audio:
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
const result = await feature.generate('Forest ambience with birds', {
|
|
168
|
+
audioType: 'ambient',
|
|
169
|
+
duration: 60,
|
|
170
|
+
});
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Voice
|
|
174
|
+
|
|
175
|
+
Generate voice content:
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
const result = await feature.generate('Narrator voice introducing topic', {
|
|
179
|
+
audioType: 'voice',
|
|
180
|
+
duration: 10,
|
|
181
|
+
});
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Usage Flow
|
|
185
|
+
|
|
186
|
+
1. Enter **Description** - Describe the audio you want
|
|
187
|
+
2. Choose **Audio Type** - Select music, SFX, ambient, or voice
|
|
188
|
+
3. Set **Duration** - Choose length
|
|
189
|
+
4. Configure **Options** - Set genre, mood, tempo (for music)
|
|
190
|
+
5. Tap **Generate** - Create the audio
|
|
191
|
+
6. Play & Save - Listen to the result and save
|
|
192
|
+
|
|
193
|
+
## Component Examples
|
|
194
|
+
|
|
195
|
+
### Audio Type Selector
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
199
|
+
|
|
200
|
+
const audioTypes = [
|
|
201
|
+
{ id: 'music', name: 'Music', description: 'Musical compositions' },
|
|
202
|
+
{ id: 'sfx', name: 'Sound Effects', description: 'SFX and foley' },
|
|
203
|
+
{ id: 'ambient', name: 'Ambient', description: 'Background audio' },
|
|
204
|
+
{ id: 'voice', name: 'Voice', description: 'Voice content' },
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
<GridSelector
|
|
208
|
+
options={audioTypes}
|
|
209
|
+
selectedOption={selectedType}
|
|
210
|
+
onSelectOption={setSelectedType}
|
|
211
|
+
/>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Genre Selector (for Music)
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
218
|
+
|
|
219
|
+
const genres = [
|
|
220
|
+
{ id: 'rock', name: 'Rock' },
|
|
221
|
+
{ id: 'pop', name: 'Pop' },
|
|
222
|
+
{ id: 'jazz', name: 'Jazz' },
|
|
223
|
+
{ id: 'electronic', name: 'Electronic' },
|
|
224
|
+
{ id: 'classical', name: 'Classical' },
|
|
225
|
+
{ id: 'hiphop', name: 'Hip Hop' },
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
<GridSelector
|
|
229
|
+
options={genres}
|
|
230
|
+
selectedOption={selectedGenre}
|
|
231
|
+
onSelectOption={setSelectedGenre}
|
|
232
|
+
/>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Mood Selector
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
239
|
+
|
|
240
|
+
const moods = [
|
|
241
|
+
{ id: 'happy', name: 'Happy' },
|
|
242
|
+
{ id: 'sad', name: 'Sad' },
|
|
243
|
+
{ id: 'energetic', name: 'Energetic' },
|
|
244
|
+
{ id: 'calm', name: 'Calm' },
|
|
245
|
+
{ id: 'dramatic', name: 'Dramatic' },
|
|
246
|
+
{ id: 'romantic', name: 'Romantic' },
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
<GridSelector
|
|
250
|
+
options={moods}
|
|
251
|
+
selectedOption={selectedMood}
|
|
252
|
+
onSelectOption={setSelectedMood}
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Duration Slider
|
|
257
|
+
|
|
258
|
+
```tsx
|
|
259
|
+
import { Slider } from 'react-native';
|
|
260
|
+
|
|
261
|
+
<Slider
|
|
262
|
+
minimumValue={5}
|
|
263
|
+
maximumValue={120}
|
|
264
|
+
step={5}
|
|
265
|
+
value={duration}
|
|
266
|
+
onValueChange={setDuration}
|
|
267
|
+
/>
|
|
268
|
+
|
|
269
|
+
<Text>Duration: {duration} seconds</Text>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Audio Player
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
import { Audio } from 'expo-av';
|
|
276
|
+
import { useState, useEffect } from 'react';
|
|
277
|
+
|
|
278
|
+
const [sound, setSound] = useState<Sound | null>(null);
|
|
279
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
280
|
+
|
|
281
|
+
const playAudio = async () => {
|
|
282
|
+
const { sound } = await Audio.Sound.createAsync(
|
|
283
|
+
{ uri: audioUrl },
|
|
284
|
+
{ shouldPlay: true }
|
|
285
|
+
);
|
|
286
|
+
setSound(sound);
|
|
287
|
+
setIsPlaying(true);
|
|
288
|
+
|
|
289
|
+
sound.setOnPlaybackStatusUpdate((status) => {
|
|
290
|
+
if (status.isLoaded && status.didJustFinish) {
|
|
291
|
+
setIsPlaying(false);
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const stopAudio = async () => {
|
|
297
|
+
if (sound) {
|
|
298
|
+
await sound.stopAsync();
|
|
299
|
+
setIsPlaying(false);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
return sound ? () => sound.unloadAsync() : undefined;
|
|
305
|
+
}, [sound]);
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Use Cases
|
|
309
|
+
|
|
310
|
+
### Background Music
|
|
311
|
+
|
|
312
|
+
```tsx
|
|
313
|
+
// Generate background music for videos
|
|
314
|
+
const result = await feature.generate('Upbeat background music', {
|
|
315
|
+
audioType: 'music',
|
|
316
|
+
genre: 'pop',
|
|
317
|
+
mood: 'energetic',
|
|
318
|
+
duration: 60,
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Sound Effects
|
|
323
|
+
|
|
324
|
+
```tsx
|
|
325
|
+
// Create sound effects for games or videos
|
|
326
|
+
const result = await feature.generate('Magic spell sound', {
|
|
327
|
+
audioType: 'sfx',
|
|
328
|
+
duration: 3,
|
|
329
|
+
});
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Ambient Sounds
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
// Generate ambient backgrounds
|
|
336
|
+
const result = await feature.generate('Ocean waves with seagulls', {
|
|
337
|
+
audioType: 'ambient',
|
|
338
|
+
duration: 120,
|
|
339
|
+
});
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Podcast Intro
|
|
343
|
+
|
|
344
|
+
```tsx
|
|
345
|
+
// Generate podcast intro music
|
|
346
|
+
const result = await feature.generate('Podcast intro music', {
|
|
347
|
+
audioType: 'music',
|
|
348
|
+
genre: 'electronic',
|
|
349
|
+
mood: 'energetic',
|
|
350
|
+
duration: 15,
|
|
351
|
+
});
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Best Practices
|
|
355
|
+
|
|
356
|
+
1. **Descriptive Prompts**: Be specific about the audio you want
|
|
357
|
+
2. **Duration**: Start with shorter durations for testing
|
|
358
|
+
3. **Genre Matching**: Match genre to your use case
|
|
359
|
+
4. **Mood Selection**: Choose appropriate mood for your content
|
|
360
|
+
5. **Multiple Takes**: Generate multiple versions to choose from
|
|
361
|
+
|
|
362
|
+
## Related Features
|
|
363
|
+
|
|
364
|
+
- [Text to Voice](../text-to-voice) - Convert text to speech
|
|
365
|
+
- [Script Generator](../script-generator) - Generate audio scripts
|
|
366
|
+
- [Text to Video](../text-to-video) - Generate videos with audio
|
|
367
|
+
|
|
368
|
+
## License
|
|
369
|
+
|
|
370
|
+
MIT
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
# Colorization
|
|
2
|
+
|
|
3
|
+
Add color to black and white photos using AI.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Automatically add realistic color to B&W photos
|
|
8
|
+
- Preserve historical accuracy
|
|
9
|
+
- Multiple colorization options
|
|
10
|
+
- Natural-looking color tones
|
|
11
|
+
- Support for various photo types
|
|
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 { useColorizationFeature } from '@umituz/react-native-ai-generation-content';
|
|
27
|
+
import * as ImagePicker from 'react-native-image-picker';
|
|
28
|
+
|
|
29
|
+
function ColorizationScreen() {
|
|
30
|
+
const [photo, setPhoto] = useState<string | null>(null);
|
|
31
|
+
|
|
32
|
+
const feature = useColorizationFeature({
|
|
33
|
+
config: {
|
|
34
|
+
colorizationType: 'auto',
|
|
35
|
+
saturation: 1.0,
|
|
36
|
+
onProcessingStart: () => console.log('Colorizing photo...'),
|
|
37
|
+
onProcessingComplete: (result) => console.log('Complete:', result),
|
|
38
|
+
onError: (error) => console.error('Error:', error),
|
|
39
|
+
},
|
|
40
|
+
onSelectPhoto: 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
|
+
setPhoto(base64);
|
|
45
|
+
return base64;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
},
|
|
49
|
+
onSaveResult: async (imageUrl) => {
|
|
50
|
+
await saveToGallery(imageUrl);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<View>
|
|
56
|
+
<PhotoUploadCard
|
|
57
|
+
image={photo}
|
|
58
|
+
onSelectImage={feature.selectPhoto}
|
|
59
|
+
title="Select Black & White Photo"
|
|
60
|
+
/>
|
|
61
|
+
|
|
62
|
+
<ColorizationTypeSelector
|
|
63
|
+
selectedType={feature.state.colorizationType}
|
|
64
|
+
onSelectType={feature.setColorizationType}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<SaturationSlider
|
|
68
|
+
value={feature.state.saturation}
|
|
69
|
+
onChange={feature.setSaturation}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<Button
|
|
73
|
+
title="Colorize Photo"
|
|
74
|
+
onPress={feature.process}
|
|
75
|
+
disabled={!feature.isReady || feature.state.isProcessing}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
{feature.state.isProcessing && (
|
|
79
|
+
<ActivityIndicator />
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
{feature.state.result && (
|
|
83
|
+
<ResultDisplay
|
|
84
|
+
originalImage={photo}
|
|
85
|
+
resultImage={feature.state.result.imageUrl}
|
|
86
|
+
onSave={() => feature.saveResult()}
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Using the Unified AI Feature Screen
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
|
|
98
|
+
|
|
99
|
+
function App() {
|
|
100
|
+
return (
|
|
101
|
+
<AIFeatureScreen
|
|
102
|
+
featureId="colorization"
|
|
103
|
+
userId="user-123"
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration Options
|
|
110
|
+
|
|
111
|
+
### Feature Config
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
interface ColorizationFeatureConfig {
|
|
115
|
+
colorizationType?: 'auto' | 'vintage' | 'vibrant' | 'natural';
|
|
116
|
+
saturation?: number; // Color saturation level (0.5 - 1.5)
|
|
117
|
+
onProcessingStart?: () => void;
|
|
118
|
+
onProcessingComplete?: (result: ColorizationResult) => void;
|
|
119
|
+
onError?: (error: string) => void;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Processing Options
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
interface ColorizationOptions {
|
|
127
|
+
colorizationType: 'auto' | 'vintage' | 'vibrant' | 'natural';
|
|
128
|
+
saturation: number; // Saturation multiplier (0.5 - 1.5)
|
|
129
|
+
preserveTexture?: boolean; // Maintain photo texture (default: true)
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Colorization Types
|
|
134
|
+
|
|
135
|
+
### Auto
|
|
136
|
+
|
|
137
|
+
Automatic color detection and application:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
const result = await feature.process({
|
|
141
|
+
colorizationType: 'auto',
|
|
142
|
+
saturation: 1.0,
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Vintage
|
|
147
|
+
|
|
148
|
+
Historically accurate vintage tones:
|
|
149
|
+
|
|
150
|
+
```tsx
|
|
151
|
+
const result = await feature.process({
|
|
152
|
+
colorizationType: 'vintage',
|
|
153
|
+
saturation: 0.8,
|
|
154
|
+
});
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Vibrant
|
|
158
|
+
|
|
159
|
+
Rich, saturated colors:
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
const result = await feature.process({
|
|
163
|
+
colorizationType: 'vibrant',
|
|
164
|
+
saturation: 1.3,
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Natural
|
|
169
|
+
|
|
170
|
+
Subtle, natural-looking colors:
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
const result = await feature.process({
|
|
174
|
+
colorizationType: 'natural',
|
|
175
|
+
saturation: 0.9,
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Usage Flow
|
|
180
|
+
|
|
181
|
+
1. Select **Photo** - Choose a black and white photo
|
|
182
|
+
2. Choose **Type** - Select colorization style
|
|
183
|
+
3. Adjust **Saturation** - Control color intensity
|
|
184
|
+
4. Tap **Colorize** - Start colorization
|
|
185
|
+
5. View **Result** - See the colorized photo
|
|
186
|
+
6. Save or Share - Save or share the result
|
|
187
|
+
|
|
188
|
+
## Component Examples
|
|
189
|
+
|
|
190
|
+
### Colorization Type Selector
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { GridSelector } from '@umituz/react-native-ai-generation-content';
|
|
194
|
+
|
|
195
|
+
const types = [
|
|
196
|
+
{ id: 'auto', name: 'Auto', description: 'Automatic detection' },
|
|
197
|
+
{ id: 'vintage', name: 'Vintage', description: 'Historical tones' },
|
|
198
|
+
{ id: 'vibrant', name: 'Vibrant', description: 'Rich colors' },
|
|
199
|
+
{ id: 'natural', name: 'Natural', description: 'Subtle colors' },
|
|
200
|
+
];
|
|
201
|
+
|
|
202
|
+
<GridSelector
|
|
203
|
+
options={types}
|
|
204
|
+
selectedOption={selectedType}
|
|
205
|
+
onSelectOption={setSelectedType}
|
|
206
|
+
/>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Saturation Slider
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { Slider } from 'react-native';
|
|
213
|
+
|
|
214
|
+
<Slider
|
|
215
|
+
minimumValue={0.5}
|
|
216
|
+
maximumValue={1.5}
|
|
217
|
+
step={0.1}
|
|
218
|
+
value={saturation}
|
|
219
|
+
onValueChange={setSaturation}
|
|
220
|
+
/>
|
|
221
|
+
|
|
222
|
+
<Text>Saturation: {saturation.toFixed(1)}x</Text>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Before/After Comparison
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
|
|
229
|
+
|
|
230
|
+
{feature.state.result && photo && (
|
|
231
|
+
<ResultDisplay
|
|
232
|
+
originalImage={photo}
|
|
233
|
+
resultImage={feature.state.result.imageUrl}
|
|
234
|
+
onSave={() => feature.saveResult()}
|
|
235
|
+
onShare={() => shareImage(feature.state.result.imageUrl)}
|
|
236
|
+
/>
|
|
237
|
+
)}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## Use Cases
|
|
241
|
+
|
|
242
|
+
### Family Photos
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
// Colorize old family photos
|
|
246
|
+
const result = await feature.process({
|
|
247
|
+
colorizationType: 'vintage',
|
|
248
|
+
saturation: 0.9,
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Historical Photos
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
// Add color to historical images
|
|
256
|
+
const result = await feature.process({
|
|
257
|
+
colorizationType: 'natural',
|
|
258
|
+
saturation: 0.8,
|
|
259
|
+
preserveTexture: true,
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Artistic Effect
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
// Create vibrant colorized artwork
|
|
267
|
+
const result = await feature.process({
|
|
268
|
+
colorizationType: 'vibrant',
|
|
269
|
+
saturation: 1.4,
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Best Practices
|
|
274
|
+
|
|
275
|
+
1. **Photo Quality**: Use high-quality scans for best results
|
|
276
|
+
2. **Type Selection**: Use Vintage for historical accuracy
|
|
277
|
+
3. **Saturation**: Start with 1.0 and adjust as needed
|
|
278
|
+
4. **Multiple Tries**: Different types work better for different photos
|
|
279
|
+
5. **Texture Preservation**: Enable for photos with important textures
|
|
280
|
+
|
|
281
|
+
## Related Features
|
|
282
|
+
|
|
283
|
+
- [Photo Restoration](../photo-restoration) - Restore old photos
|
|
284
|
+
- [Upscaling](../upscaling) - Increase image resolution
|
|
285
|
+
- [HD Touch Up](../hd-touch-up) - Enhance photo quality
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
MIT
|