@imgly/plugin-ai-image-generation-web 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -31,13 +31,15 @@ To use the plugin, import it and configure it with your preferred providers:
31
31
  import CreativeEditorSDK from '@cesdk/cesdk-js';
32
32
  import ImageGeneration from '@imgly/plugin-ai-image-generation-web';
33
33
  import FalAiImage from '@imgly/plugin-ai-image-generation-web/fal-ai';
34
+ // For OpenAI providers
35
+ import OpenAiImage from '@imgly/plugin-ai-image-generation-web/open-ai';
34
36
 
35
37
  // Initialize CreativeEditor SDK
36
38
  CreativeEditorSDK.create(domElement, {
37
39
  license: 'your-license-key',
38
40
  // Other configuration options...
39
41
  }).then(async (cesdk) => {
40
- // Add the image generation plugin
42
+ // Add the image generation plugin with fal.ai providers
41
43
  cesdk.addPlugin(
42
44
  ImageGeneration({
43
45
  // Text-to-image provider
@@ -55,16 +57,35 @@ CreativeEditorSDK.create(domElement, {
55
57
  dryRun: false
56
58
  })
57
59
  );
60
+
61
+ // Alternatively, use OpenAI providers
62
+ // cesdk.addPlugin(
63
+ // ImageGeneration({
64
+ // // Text-to-image provider
65
+ // text2image: OpenAiImage.GptImage1.Text2Image({
66
+ // proxyUrl: 'https://your-openai-proxy.example.com'
67
+ // }),
68
+ //
69
+ // // Image-to-image provider (optional)
70
+ // image2image: OpenAiImage.GptImage1.Image2Image({
71
+ // proxyUrl: 'https://your-openai-proxy.example.com'
72
+ // }),
73
+ //
74
+ // // Optional configuration
75
+ // debug: false,
76
+ // dryRun: false
77
+ // })
78
+ // );
58
79
  });
59
80
  ```
60
81
 
61
82
  ### Providers
62
83
 
63
- The plugin comes with two pre-configured providers for fal.ai models:
84
+ The plugin comes with pre-configured providers for fal.ai and OpenAI models:
64
85
 
65
86
  #### 1. RecraftV3 (Text-to-Image)
66
87
 
67
- A versatile text-to-image model that generates images based on text prompts:
88
+ A versatile text-to-image model from fal.ai that generates images based on text prompts:
68
89
 
69
90
  ```typescript
70
91
  text2image: FalAiImage.RecraftV3({
@@ -78,9 +99,25 @@ Key features:
78
99
  - Custom dimensions support
79
100
  - Adjustable quality settings
80
101
 
81
- #### 2. GeminiFlashEdit (Image-to-Image)
102
+ #### 2. GptImage1.Text2Image (Text-to-Image)
103
+
104
+ OpenAI's GPT-4 Vision based text-to-image model that generates high-quality images:
105
+
106
+ ```typescript
107
+ text2image: OpenAiImage.GptImage1.Text2Image({
108
+ proxyUrl: 'https://your-openai-proxy.example.com'
109
+ })
110
+ ```
111
+
112
+ Key features:
113
+ - High-quality image generation
114
+ - Multiple size options (1024×1024, 1536×1024, 1024×1536)
115
+ - Background transparency options
116
+ - Automatic prompt optimization
117
+
118
+ #### 3. GeminiFlashEdit (Image-to-Image)
82
119
 
83
- An image modification model that transforms existing images:
120
+ An image modification model from fal.ai that transforms existing images:
84
121
 
85
122
  ```typescript
86
123
  image2image: FalAiImage.GeminiFlashEdit({
@@ -92,6 +129,23 @@ Key features:
92
129
  - Transform existing images with text prompts
93
130
  - Available directly through canvas quick actions
94
131
  - Maintains original image dimensions
132
+ - Includes style presets and artist-specific transformations
133
+
134
+ #### 4. GptImage1.Image2Image (Image-to-Image)
135
+
136
+ OpenAI's GPT-4 Vision based image editing model that can transform existing images:
137
+
138
+ ```typescript
139
+ image2image: OpenAiImage.GptImage1.Image2Image({
140
+ proxyUrl: 'https://your-openai-proxy.example.com'
141
+ })
142
+ ```
143
+
144
+ Key features:
145
+ - Powerful image transformation capabilities
146
+ - Supports the same quick actions as GeminiFlashEdit
147
+ - Maintains original image dimensions
148
+ - Can be used as a direct alternative to GeminiFlashEdit
95
149
 
96
150
  ### Configuration Options
97
151
 
@@ -257,6 +311,53 @@ The plugin automatically registers the following UI components:
257
311
  3. **History Library**: Displays previously generated images
258
312
  4. **Dock Component**: A button in the dock area to open the image generation panel
259
313
 
314
+ ### Quick Action Features
315
+
316
+ The plugin includes several pre-configured quick actions for both providers, built using helper components from the core generation library:
317
+
318
+ 1. **Change Image**: Edit the currently selected image using a text prompt
319
+ 2. **Swap Background**: Change only the background of the selected image
320
+ 3. **Create Variant**: Duplicate the selected image and generate a variant
321
+ 4. **Style Transfer**: Apply different artistic styles to the selected image (GeminiFlashEdit only)
322
+ 5. **Artist Painting Styles**: Transform the image in the style of famous artists (GeminiFlashEdit only)
323
+
324
+ These quick actions are implemented using helper components from `@imgly/plugin-ai-generation-web`:
325
+
326
+ ```typescript
327
+ // Example of how the GptImage1 provider implements quick actions
328
+ function createQuickActions(cesdk): QuickAction[] {
329
+ return [
330
+ // Swap background quick action
331
+ QuickActionSwapImageBackground({
332
+ mapInput: (input) => ({ ...input, image_url: input.uri }),
333
+ cesdk
334
+ }),
335
+
336
+ // Change image quick action
337
+ QuickActionChangeImage({
338
+ mapInput: (input) => ({ ...input, image_url: input.uri }),
339
+ cesdk
340
+ }),
341
+
342
+ // Create variant quick action
343
+ QuickActionImageVariant({
344
+ onApply: async ({ prompt, uri, duplicatedBlockId }, context) => {
345
+ return context.generate(
346
+ {
347
+ prompt,
348
+ image_url: uri
349
+ },
350
+ {
351
+ blockIds: [duplicatedBlockId]
352
+ }
353
+ );
354
+ },
355
+ cesdk
356
+ })
357
+ ];
358
+ }
359
+ ```
360
+
260
361
  ### Panel IDs
261
362
 
262
363
  - Main panel: `ly.img.ai/image-generation`
@@ -264,12 +365,16 @@ The plugin automatically registers the following UI components:
264
365
  - Provider-specific panels:
265
366
  - RecraftV3: `ly.img.ai/fal-ai/recraft-v3`
266
367
  - GeminiFlashEdit: `ly.img.ai/fal-ai/gemini-flash-edit`
368
+ - GptImage1.Text2Image: `ly.img.ai/open-ai/gpt-image-1/text2image`
369
+ - GptImage1.Image2Image: `ly.img.ai/open-ai/gpt-image-1/image2image`
267
370
 
268
371
  ### Asset History
269
372
 
270
373
  Generated images are automatically stored in asset sources with the following IDs:
271
374
  - RecraftV3: `fal-ai/recraft-v3.history`
272
375
  - GeminiFlashEdit: `fal-ai/gemini-flash-edit.history`
376
+ - GptImage1.Text2Image: `open-ai/gpt-image-1/text2image.history`
377
+ - GptImage1.Image2Image: `open-ai/gpt-image-1/image2image.history`
273
378
 
274
379
  ### Dock Integration
275
380