@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,289 +1,393 @@
1
- # Colorization
1
+ # Colorization Feature
2
2
 
3
3
  Add color to black and white photos using AI.
4
4
 
5
- ## Features
5
+ ## 📍 Import Path
6
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
7
+ ```typescript
8
+ import { useColorizationFeature } from '@umituz/react-native-ai-generation-content';
9
+ ```
12
10
 
13
- ## Installation
11
+ **Location**: `src/features/colorization/`
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
+ Automatically add realistic color to black and white photos using AI. Supports multiple colorization styles including vintage for historical accuracy, vibrant for rich colors, natural for subtle tones, and auto for intelligent detection.
20
16
 
21
- ## Basic Usage
17
+ ---
22
18
 
23
- ### Using the Hook
19
+ ## 📋 Usage Strategy
24
20
 
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
- ```
21
+ ### When to Use This Feature
93
22
 
94
- ### Using the Unified AI Feature Screen
23
+ **Use Cases:**
24
+ - Colorizing old family photographs
25
+ - Adding color to historical images
26
+ - Creating artistic colorized versions
27
+ - Restoring faded color photos
28
+ - Creative visual effects
95
29
 
96
- ```tsx
97
- import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
30
+ ❌ **When NOT to Use:**
31
+ - Photo restoration with damage (use Photo Restoration)
32
+ - Image enhancement without colorization (use HD Touch Up)
33
+ - Color correction of existing color photos (use image editing software)
34
+ - Adding artistic filters (use Style Transfer)
98
35
 
99
- function App() {
100
- return (
101
- <AIFeatureScreen
102
- featureId="colorization"
103
- userId="user-123"
104
- />
105
- );
106
- }
107
- ```
36
+ ### Implementation Strategy
108
37
 
109
- ## Configuration Options
38
+ 1. **Select black & white photo** to colorize
39
+ 2. **Choose colorization type** (auto, vintage, vibrant, natural)
40
+ 3. **Adjust saturation level** (0.5 to 1.5)
41
+ 4. **Generate colorized version** with progress tracking
42
+ 5. **Preview and compare** with original
43
+ 6. **Save or share** result
110
44
 
111
- ### Feature Config
45
+ ---
112
46
 
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
- }
47
+ ## ⚠️ Critical Rules (MUST FOLLOW)
48
+
49
+ ### 1. Image Requirements
50
+ - **MUST** provide ONE black & white photo
51
+ - **MUST** use high-quality scans or photos (min 512x512)
52
+ - **MUST** have clear, recognizable content
53
+ - **MUST NOT** exceed file size limits (10MB max)
54
+ - **MUST** be actual B&W or desaturated photos
55
+
56
+ ### 2. Configuration
57
+ - **MUST** provide valid `userId` for tracking
58
+ - **MUST** specify `colorizationType` (auto, vintage, vibrant, natural)
59
+ - **MUST** set `saturation` level (0.5 to 1.5)
60
+ - **MUST** implement `onError` callback
61
+ - **MUST** implement `onSelectPhoto` callback
62
+
63
+ ### 3. State Management
64
+ - **MUST** check `isReady` before enabling colorize button
65
+ - **MUST** display progress during colorization
66
+ - **MUST** handle long processing times
67
+ - **MUST** display `error` state with clear messages
68
+ - **MUST** implement proper cleanup on unmount
69
+
70
+ ### 4. Performance
71
+ - **MUST** implement image compression before upload
72
+ - **MUST** show progress indicator for processing
73
+ - **MUST** cache results locally
74
+ - **MUST** allow users to cancel processing
75
+ - **MUST NOT** colorize multiple photos simultaneously
76
+
77
+ ### 5. Content Quality
78
+ - **MUST** provide before/after comparison
79
+ - **MUST** allow saturation adjustment
80
+ - **MUST** handle various photo types
81
+ - **MUST** preserve photo texture when enabled
82
+ - **MUST** offer regeneration with different settings
83
+
84
+ ---
85
+
86
+ ## 🚫 Prohibitions (MUST AVOID)
87
+
88
+ ### Strictly Forbidden
89
+
90
+ ❌ **NEVER** do the following:
91
+
92
+ 1. **No Color Images**
93
+ - Always validate input is B&W or desaturated
94
+ - Never attempt to colorize already color photos
95
+
96
+ 2. **No Auto-Processing**
97
+ - Never start colorization without user action
98
+ - Always require explicit "Colorize" button press
99
+ - Show preview before processing
100
+
101
+ 3. **No Hardcoded Credentials**
102
+ - Never store API keys in component files
103
+ - Use environment variables or secure storage
104
+
105
+ 4. **No Unhandled Errors**
106
+ - Never ignore colorization failures
107
+ - Always explain what went wrong
108
+ - Provide retry or alternative options
109
+
110
+ 5. **No Memory Leaks**
111
+ - Never store both original and colorized simultaneously
112
+ - Clean up temporary images
113
+ - Implement proper image disposal
114
+
115
+ 6. **No Blocked UI**
116
+ - Never block main thread with image processing
117
+ - Always show progress indicator
118
+ - Allow cancellation
119
+
120
+ 7. **No Historical Inaccuracy**
121
+ - Never claim colorized versions are historically accurate
122
+ - Provide disclaimer about AI interpretation
123
+ - Allow manual color adjustments for accuracy
124
+
125
+ ---
126
+
127
+ ## 🤖 AI Agent Directions
128
+
129
+ ### For AI Code Generation Tools
130
+
131
+ When using this feature with AI code generation tools, follow these guidelines:
132
+
133
+ #### Prompt Template for AI Agents
134
+
135
+ ```
136
+ You are implementing a colorization feature using @umituz/react-native-ai-generation-content.
137
+
138
+ REQUIREMENTS:
139
+ 1. Import from: @umituz/react-native-ai-generation-content
140
+ 2. Use the useColorizationFeature hook
141
+ 3. Select colorization type (auto, vintage, vibrant, natural)
142
+ 4. Implement photo selection UI
143
+ 5. Adjust saturation level (0.5 to 1.5)
144
+ 6. Validate photo is black & white
145
+ 7. Show before/after comparison
146
+ 8. Handle long processing times with progress
147
+ 9. Implement proper error handling
148
+ 10. Implement cleanup on unmount
149
+
150
+ CRITICAL RULES:
151
+ - MUST validate photo is black & white before colorizing
152
+ - MUST show before/after comparison
153
+ - MUST handle saturation adjustment
154
+ - MUST preserve photo texture when enabled
155
+ - MUST implement debouncing (300ms)
156
+ - MUST allow colorization regeneration
157
+
158
+ CONFIGURATION:
159
+ - Provide valid userId (string)
160
+ - Set colorizationType: 'auto' | 'vintage' | 'vibrant' | 'natural'
161
+ - Set saturation: 0.5 to 1.5 (default: 1.0)
162
+ - Set preserveTexture: boolean (maintain photo texture)
163
+ - Implement onSelectPhoto callback
164
+ - Implement onSaveResult callback
165
+ - Configure callbacks: onProcessingStart, onProcessingComplete, onError
166
+
167
+ COLORIZATION TYPES:
168
+ - auto: Automatic color detection and application
169
+ - vintage: Historically accurate vintage tones
170
+ - vibrant: Rich, saturated colors
171
+ - natural: Subtle, natural-looking colors
172
+
173
+ OPTIONS:
174
+ - saturation: Color intensity (0.5 muted to 1.5 vibrant)
175
+ - preserveTexture: Maintain photo texture (default: true)
176
+
177
+ STRICTLY FORBIDDEN:
178
+ - No color photo validation
179
+ - No auto-processing without user action
180
+ - No hardcoded API keys
181
+ - No unhandled errors
182
+ - No memory leaks
183
+ - No blocking UI
184
+ - No historical accuracy claims
185
+
186
+ QUALITY CHECKLIST:
187
+ - [ ] Photo selection implemented
188
+ - [ ] B&W photo validation added
189
+ - [ ] Colorization type selector included
190
+ - [ ] Saturation slider included
191
+ - [ ] Before/after comparison view
192
+ - [ ] Progress indicator during processing
193
+ - [ ] Error display with retry option
194
+ - [ ] Download/share functionality
195
+ - [ ] Regeneration with different settings
121
196
  ```
122
197
 
123
- ### Processing Options
198
+ #### AI Implementation Checklist
199
+
200
+ Use this checklist when generating code:
201
+
202
+ - [ ] Feature imported from correct path
203
+ - [ ] Photo selection implemented
204
+ - [ ] B&W validation added
205
+ - [ ] Colorization type selector added
206
+ - [ ] Saturation control implemented
207
+ - [ ] Validation before colorize()
208
+ - [ ] Before/after comparison view
209
+ - [ ] Progress indicator during processing
210
+ - [ ] Error display with user-friendly message
211
+ - [ ] Download/share buttons
212
+ - [ ] Regeneration option
213
+ - [ ] Cleanup on unmount
214
+ - [ ] Original photo preserved
215
+
216
+ ---
217
+
218
+ ## 🛠️ Configuration Strategy
219
+
220
+ ### Essential Configuration
221
+
222
+ ```typescript
223
+ // Required fields
224
+ {
225
+ userId: string
226
+ colorizationType: 'auto' | 'vintage' | 'vibrant' | 'natural'
227
+ saturation: number // 0.5 to 1.5
228
+ onSelectPhoto: () => Promise<string | null>
229
+ }
124
230
 
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)
231
+ // Optional callbacks
232
+ {
233
+ onProcessingStart?: () => void
234
+ onProcessingComplete?: (result) => void
235
+ onError?: (error: string) => void
130
236
  }
131
237
  ```
132
238
 
133
- ## Colorization Types
239
+ ### Recommended Settings
134
240
 
135
- ### Auto
241
+ 1. **Colorization Types**
242
+ - Auto: Automatic color detection (recommended for most photos)
243
+ - Vintage: Historical accuracy for old photos
244
+ - Vibrant: Rich, saturated colors for artistic effect
245
+ - Natural: Subtle, natural-looking colors
136
246
 
137
- Automatic color detection and application:
247
+ 2. **Saturation Levels**
248
+ - 0.5-0.7: Muted colors (historical feel)
249
+ - 0.8-1.0: Natural colors (recommended)
250
+ - 1.1-1.5: Vibrant colors (artistic effect)
138
251
 
139
- ```tsx
140
- const result = await feature.process({
141
- colorizationType: 'auto',
142
- saturation: 1.0,
143
- });
144
- ```
252
+ 3. **Image Quality**
253
+ - Minimum: 512x512 resolution
254
+ - Recommended: 1024x1024 or higher
255
+ - Format: JPEG or PNG
256
+ - Max size: 10MB
145
257
 
146
- ### Vintage
258
+ ---
147
259
 
148
- Historically accurate vintage tones:
260
+ ## 📊 State Management
149
261
 
150
- ```tsx
151
- const result = await feature.process({
152
- colorizationType: 'vintage',
153
- saturation: 0.8,
154
- });
155
- ```
262
+ ### Feature States
156
263
 
157
- ### Vibrant
264
+ **isReady**: boolean
265
+ - Photo selected and validated as B&W
266
+ - Check before enabling colorize button
158
267
 
159
- Rich, saturated colors:
268
+ **isProcessing**: boolean
269
+ - Colorization in progress
270
+ - Show loading/progress indicator
271
+ - Disable colorize button
160
272
 
161
- ```tsx
162
- const result = await feature.process({
163
- colorizationType: 'vibrant',
164
- saturation: 1.3,
165
- });
166
- ```
273
+ **progress**: number (0-100)
274
+ - Colorization progress percentage
275
+ - Update progress bar
167
276
 
168
- ### Natural
277
+ **error**: string | null
278
+ - Error message if colorization failed
279
+ - Display to user with clear message
169
280
 
170
- Subtle, natural-looking colors:
281
+ **result**: {
282
+ imageUrl: string
283
+ originalImageUrl?: string
284
+ colorizationType?: string
285
+ saturation?: number
286
+ metadata?: any
287
+ }
171
288
 
172
- ```tsx
173
- const result = await feature.process({
174
- colorizationType: 'natural',
175
- saturation: 0.9,
176
- });
177
- ```
289
+ ---
178
290
 
179
- ## Usage Flow
291
+ ## 🎨 Best Practices
180
292
 
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
293
+ ### Photo Selection
187
294
 
188
- ## Component Examples
295
+ 1. **Photo Quality**
296
+ - Good: High-quality scans, clear content
297
+ - Bad: Blurry, low-resolution scans
189
298
 
190
- ### Colorization Type Selector
299
+ 2. **Type Selection**
300
+ - Use Vintage for historical photos
301
+ - Use Vibrant for artistic effect
302
+ - Use Natural for subtle enhancement
303
+ - Use Auto for general use
191
304
 
192
- ```tsx
193
- import { GridSelector } from '@umituz/react-native-ai-generation-content';
305
+ 3. **Saturation**
306
+ - Start with 1.0 for natural look
307
+ - Lower for vintage/historical feel
308
+ - Higher for vibrant colors
194
309
 
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
- ];
310
+ ### User Experience
201
311
 
202
- <GridSelector
203
- options={types}
204
- selectedOption={selectedType}
205
- onSelectOption={setSelectedType}
206
- />
207
- ```
312
+ 1. **Preview**
313
+ - Show B&W preview before colorizing
314
+ - Compare different colorization types
315
+ - Allow saturation adjustment
208
316
 
209
- ### Saturation Slider
317
+ 2. **Before/After Comparison**
318
+ - Side-by-side comparison
319
+ - Slider for easy comparison
320
+ - Zoom for detail inspection
210
321
 
211
- ```tsx
212
- import { Slider } from 'react-native';
322
+ ---
213
323
 
214
- <Slider
215
- minimumValue={0.5}
216
- maximumValue={1.5}
217
- step={0.1}
218
- value={saturation}
219
- onValueChange={setSaturation}
220
- />
324
+ ## 🐛 Common Pitfalls
221
325
 
222
- <Text>Saturation: {saturation.toFixed(1)}x</Text>
223
- ```
326
+ ### Validation Issues
224
327
 
225
- ### Before/After Comparison
328
+ **Problem**: Attempting to colorize color photos
329
+ ✅ **Solution**: Validate photo is B&W before processing
226
330
 
227
- ```tsx
228
- import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
331
+ ### Quality Issues
229
332
 
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
- ```
333
+ **Problem**: Poor colorization results
334
+ ✅ **Solution**: Use higher quality scan, try different type
239
335
 
240
- ## Use Cases
336
+ ### Historical Accuracy
241
337
 
242
- ### Family Photos
338
+ **Problem**: Colors don't match historical reality
339
+ ✅ **Solution**: Use vintage type, provide manual adjustment option
243
340
 
244
- ```tsx
245
- // Colorize old family photos
246
- const result = await feature.process({
247
- colorizationType: 'vintage',
248
- saturation: 0.9,
249
- });
250
- ```
341
+ ---
251
342
 
252
- ### Historical Photos
343
+ ## 📦 Related Components
253
344
 
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
- ```
345
+ Use these components from the library:
262
346
 
263
- ### Artistic Effect
347
+ - **PhotoUploadCard**: Upload photo interface
348
+ - **ColorizationTypeSelector**: Choose colorization style
349
+ - **SaturationSlider**: Adjust color intensity
350
+ - **ResultDisplay**: Before/after comparison
351
+ - **ProgressBar**: Progress display
264
352
 
265
- ```tsx
266
- // Create vibrant colorized artwork
267
- const result = await feature.process({
268
- colorizationType: 'vibrant',
269
- saturation: 1.4,
270
- });
271
- ```
353
+ Located at: `src/presentation/components/`
354
+
355
+ ---
356
+
357
+ ## 🔄 Migration Strategy
358
+
359
+ If migrating from previous implementation:
360
+
361
+ 1. **Update imports** to new path
362
+ 2. **Add B&W photo validation**
363
+ 3. **Implement colorization type selector**
364
+ 4. **Update state handling** for new structure
365
+ 5. **Add before/after comparison**
366
+ 6. **Test all colorization types**
367
+
368
+ ---
369
+
370
+ ## 📚 Additional Resources
371
+
372
+ - Main documentation: `/docs/`
373
+ - API reference: `/docs/api/`
374
+ - Examples: `/docs/examples/basic/colorization/`
375
+ - Architecture: `/ARCHITECTURE.md`
272
376
 
273
- ## Best Practices
377
+ ---
274
378
 
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
379
+ **Last Updated**: 2025-01-08
380
+ **Version**: 2.0.0 (Strategy-based Documentation)
280
381
 
281
- ## Related Features
382
+ ---
282
383
 
283
- - [Photo Restoration](../photo-restoration) - Restore old photos
284
- - [Upscaling](../upscaling) - Increase image resolution
285
- - [HD Touch Up](../hd-touch-up) - Enhance photo quality
384
+ ## 📝 Changelog
286
385
 
287
- ## License
386
+ ### v2.0.0 - 2025-01-08
387
+ - **BREAKING**: Documentation format changed to strategy-based
388
+ - Removed extensive code examples
389
+ - Added rules, prohibitions, and AI agent directions
390
+ - Focus on best practices and implementation guidance
288
391
 
289
- MIT
392
+ ### v1.0.0 - Initial Release
393
+ - Initial feature documentation