@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.
Files changed (48) 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/hooks/base/use-dual-image-feature.ts +4 -4
  44. package/src/presentation/hooks/base/use-image-with-prompt-feature.ts +4 -4
  45. package/src/presentation/hooks/base/utils/feature-state.factory.ts +1 -1
  46. package/src/presentation/layouts/README.md +374 -0
  47. package/src/presentation/layouts/types/layout-props.ts +1 -1
  48. package/src/presentation/screens/README.md +430 -0
@@ -0,0 +1,418 @@
1
+ # Image to Image
2
+
3
+ Transform images using AI with various operations and styles.
4
+
5
+ ## Features
6
+
7
+ - Transform images with AI
8
+ - Support for single and dual image operations
9
+ - Multiple transformation modes
10
+ - Style transfer and image modification
11
+ - Flexible and extensible
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
+ ### Single Image Operation
24
+
25
+ ```tsx
26
+ import { useSingleImageFeature } from '@umituz/react-native-ai-generation-content';
27
+ import * as ImagePicker from 'react-native-image-picker';
28
+
29
+ function TransformScreen() {
30
+ const [image, setImage] = useState<string | null>(null);
31
+
32
+ const feature = useSingleImageFeature({
33
+ config: {
34
+ onProcessingStart: () => console.log('Processing...'),
35
+ onProcessingComplete: (result) => console.log('Complete:', result),
36
+ onError: (error) => console.error('Error:', error),
37
+ },
38
+ onSelectImage: async () => {
39
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
40
+ if (result.assets && result.assets[0].uri) {
41
+ const base64 = await convertToBase64(result.assets[0].uri);
42
+ setImage(base64);
43
+ return base64;
44
+ }
45
+ return null;
46
+ },
47
+ onSaveImage: async (imageUrl) => {
48
+ await saveToGallery(imageUrl);
49
+ },
50
+ buildInput: (imageBase64, config) => ({
51
+ imageBase64,
52
+ options: { mode: 'transform' },
53
+ }),
54
+ });
55
+
56
+ return (
57
+ <View>
58
+ <PhotoUploadCard
59
+ image={image}
60
+ onSelectImage={feature.selectImage}
61
+ title="Select Image"
62
+ />
63
+ <Button
64
+ title="Transform"
65
+ onPress={feature.process}
66
+ disabled={!feature.isReady}
67
+ />
68
+ {feature.state.result && (
69
+ <Image source={{ uri: feature.state.result.imageUrl }} />
70
+ )}
71
+ </View>
72
+ );
73
+ }
74
+ ```
75
+
76
+ ### Dual Image Operation
77
+
78
+ ```tsx
79
+ import { useDualImageFeature } from '@umituz/react-native-ai-generation-content';
80
+
81
+ function DualTransformScreen() {
82
+ const [image1, setImage1] = useState<string | null>(null);
83
+ const [image2, setImage2] = useState<string | null>(null);
84
+
85
+ const feature = useDualImageFeature({
86
+ config: {
87
+ onProcessingStart: () => console.log('Processing...'),
88
+ onProcessingComplete: (result) => console.log('Complete:', result),
89
+ onError: (error) => console.error('Error:', error),
90
+ },
91
+ onSelectSourceImage: async () => {
92
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
93
+ if (result.assets && result.assets[0].uri) {
94
+ return await convertToBase64(result.assets[0].uri);
95
+ }
96
+ return null;
97
+ },
98
+ onSelectTargetImage: async () => {
99
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
100
+ if (result.assets && result.assets[0].uri) {
101
+ return await convertToBase64(result.assets[0].uri);
102
+ }
103
+ return null;
104
+ },
105
+ onSaveImage: async (imageUrl) => {
106
+ await saveToGallery(imageUrl);
107
+ },
108
+ buildInput: (sourceBase64, targetBase64, config) => ({
109
+ imageBase64: sourceBase64,
110
+ targetImageBase64: targetBase64,
111
+ options: config.defaultOptions,
112
+ }),
113
+ });
114
+
115
+ return (
116
+ <View>
117
+ <DualImagePicker
118
+ sourceImage={image1}
119
+ targetImage={image2}
120
+ onSelectSourceImage={feature.selectSourceImage}
121
+ onSelectTargetImage={feature.selectTargetImage}
122
+ />
123
+ <Button
124
+ title="Process"
125
+ onPress={feature.process}
126
+ disabled={!feature.isReady}
127
+ />
128
+ {feature.state.result && (
129
+ <Image source={{ uri: feature.state.result.imageUrl }} />
130
+ )}
131
+ </View>
132
+ );
133
+ }
134
+ ```
135
+
136
+ ### Image with Prompt
137
+
138
+ ```tsx
139
+ import { useImageWithPromptFeature } from '@umituz/react-native-ai-generation-content';
140
+
141
+ function ImagePromptScreen() {
142
+ const [image, setImage] = useState<string | null>(null);
143
+ const [prompt, setPrompt] = useState('');
144
+
145
+ const feature = useImageWithPromptFeature({
146
+ config: {
147
+ onProcessingStart: () => console.log('Processing...'),
148
+ onProcessingComplete: (result) => console.log('Complete:', result),
149
+ onError: (error) => console.error('Error:', error),
150
+ },
151
+ onSelectImage: async () => {
152
+ const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
153
+ if (result.assets && result.assets[0].uri) {
154
+ const base64 = await convertToBase64(result.assets[0].uri);
155
+ setImage(base64);
156
+ return base64;
157
+ }
158
+ return null;
159
+ },
160
+ onSaveImage: async (imageUrl) => {
161
+ await saveToGallery(imageUrl);
162
+ },
163
+ buildInput: (imageBase64, promptText, config) => ({
164
+ imageBase64,
165
+ prompt: promptText,
166
+ options: config.defaultOptions,
167
+ }),
168
+ });
169
+
170
+ return (
171
+ <View>
172
+ <PhotoUploadCard
173
+ image={image}
174
+ onSelectImage={feature.selectImage}
175
+ title="Select Image"
176
+ />
177
+ <TextInput
178
+ placeholder="Describe transformation..."
179
+ value={prompt}
180
+ onChangeText={setPrompt}
181
+ />
182
+ <Button
183
+ title="Transform"
184
+ onPress={() => feature.process(prompt)}
185
+ disabled={!feature.isReady}
186
+ />
187
+ {feature.state.result && (
188
+ <Image source={{ uri: feature.state.result.imageUrl }} />
189
+ )}
190
+ </View>
191
+ );
192
+ }
193
+ ```
194
+
195
+ ## Hook Types
196
+
197
+ ### useSingleImageFeature
198
+
199
+ For operations that require a single image input:
200
+
201
+ ```tsx
202
+ const feature = useSingleImageFeature<Config, Result>({
203
+ config,
204
+ onSelectImage,
205
+ onSaveImage,
206
+ onBeforeProcess,
207
+ options: {
208
+ buildInput: (imageBase64, config) => ({ ... }),
209
+ },
210
+ });
211
+ ```
212
+
213
+ **Returns:**
214
+ ```tsx
215
+ {
216
+ state: {
217
+ image: string | null;
218
+ result: Result | null;
219
+ isProcessing: boolean;
220
+ progress: number;
221
+ error: string | null;
222
+ };
223
+ selectImage: () => Promise<void>;
224
+ process: () => Promise<void>;
225
+ saveResult: () => Promise<void>;
226
+ reset: () => void;
227
+ isReady: boolean;
228
+ }
229
+ ```
230
+
231
+ ### useDualImageFeature
232
+
233
+ For operations that require two images:
234
+
235
+ ```tsx
236
+ const feature = useDualImageFeature<Config, Result>({
237
+ config,
238
+ onSelectSourceImage,
239
+ onSelectTargetImage,
240
+ onSaveImage,
241
+ onBeforeProcess,
242
+ options: {
243
+ buildInput: (sourceBase64, targetBase64, config) => ({ ... }),
244
+ },
245
+ });
246
+ ```
247
+
248
+ **Returns:**
249
+ ```tsx
250
+ {
251
+ state: {
252
+ sourceImage: string | null;
253
+ targetImage: string | null;
254
+ result: Result | null;
255
+ isProcessing: boolean;
256
+ progress: number;
257
+ error: string | null;
258
+ };
259
+ selectSourceImage: () => Promise<void>;
260
+ selectTargetImage: () => Promise<void>;
261
+ process: () => Promise<void>;
262
+ saveResult: () => Promise<void>;
263
+ reset: () => void;
264
+ isReady: boolean;
265
+ }
266
+ ```
267
+
268
+ ### useImageWithPromptFeature
269
+
270
+ For operations that require an image and text prompt:
271
+
272
+ ```tsx
273
+ const feature = useImageWithPromptFeature<Config, Result>({
274
+ config,
275
+ onSelectImage,
276
+ onSaveImage,
277
+ onBeforeProcess,
278
+ options: {
279
+ buildInput: (imageBase64, prompt, config) => ({ ... }),
280
+ },
281
+ });
282
+ ```
283
+
284
+ **Returns:**
285
+ ```tsx
286
+ {
287
+ state: {
288
+ image: string | null;
289
+ prompt: string;
290
+ result: Result | null;
291
+ isProcessing: boolean;
292
+ progress: number;
293
+ error: string | null;
294
+ };
295
+ selectImage: () => Promise<void>;
296
+ setPrompt: (prompt: string) => void;
297
+ process: (prompt: string) => Promise<void>;
298
+ saveResult: () => Promise<void>;
299
+ reset: () => void;
300
+ isReady: boolean;
301
+ }
302
+ ```
303
+
304
+ ## Config Options
305
+
306
+ ```tsx
307
+ interface BaseFeatureConfig {
308
+ onProcessingStart?: () => void;
309
+ onProcessingComplete?: (result: any) => void;
310
+ onError?: (error: string) => void;
311
+ }
312
+
313
+ interface SingleImageFeatureConfig extends BaseFeatureConfig {
314
+ defaultOptions?: Record<string, any>;
315
+ }
316
+
317
+ interface DualImageFeatureConfig extends BaseFeatureConfig {
318
+ defaultOptions?: Record<string, any>;
319
+ }
320
+
321
+ interface ImagePromptFeatureConfig extends BaseFeatureConfig {
322
+ defaultOptions?: Record<string, any>;
323
+ }
324
+ ```
325
+
326
+ ## Component Examples
327
+
328
+ ### DualImagePicker
329
+
330
+ ```tsx
331
+ import { DualImagePicker } from '@umituz/react-native-ai-generation-content';
332
+
333
+ <DualImagePicker
334
+ sourceImage={sourceImage}
335
+ targetImage={targetImage}
336
+ onSelectSourceImage={handleSelectSource}
337
+ onSelectTargetImage={handleSelectTarget}
338
+ sourceLabel="Source Image"
339
+ targetLabel="Target Image"
340
+ />
341
+ ```
342
+
343
+ ### ResultDisplay
344
+
345
+ ```tsx
346
+ import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
347
+
348
+ <ResultDisplay
349
+ originalImage={originalImage}
350
+ resultImage={resultImage}
351
+ onSave={() => saveImage()}
352
+ onShare={() => shareImage()}
353
+ />
354
+ ```
355
+
356
+ ## Usage Examples
357
+
358
+ ### Style Transfer
359
+
360
+ ```tsx
361
+ const feature = useSingleImageFeature({
362
+ config: {
363
+ defaultOptions: { style: 'oil-painting' },
364
+ },
365
+ buildInput: (imageBase64, config) => ({
366
+ imageBase64,
367
+ style: config.defaultOptions.style,
368
+ }),
369
+ });
370
+ ```
371
+
372
+ ### Face Swap
373
+
374
+ ```tsx
375
+ const feature = useDualImageFeature({
376
+ config: {
377
+ defaultOptions: { preserveFaces: true },
378
+ },
379
+ buildInput: (sourceBase64, targetBase64, config) => ({
380
+ imageBase64: sourceBase64,
381
+ targetImageBase64: targetBase64,
382
+ preserveFaces: config.defaultOptions.preserveFaces,
383
+ }),
384
+ });
385
+ ```
386
+
387
+ ### Image Transformation
388
+
389
+ ```tsx
390
+ const feature = useImageWithPromptFeature({
391
+ config: {
392
+ defaultOptions: { strength: 0.8 },
393
+ },
394
+ buildInput: (imageBase64, prompt, config) => ({
395
+ imageBase64,
396
+ prompt,
397
+ strength: config.defaultOptions.strength,
398
+ }),
399
+ });
400
+ ```
401
+
402
+ ## Best Practices
403
+
404
+ 1. **Image Quality**: Use high-quality images for best results
405
+ 2. **Build Input**: Properly structure input based on API requirements
406
+ 3. **Error Handling**: Always handle errors gracefully
407
+ 4. **Progress Tracking**: Show progress to users during processing
408
+ 5. **Result Validation**: Validate results before presenting to users
409
+
410
+ ## Related Features
411
+
412
+ - [Style Transfer](../style-transfer) - Apply artistic styles
413
+ - [Face Swap](../face-swap) - Swap faces between images
414
+ - [Remove Background](../remove-background) - Remove backgrounds
415
+
416
+ ## License
417
+
418
+ MIT