Overview
Theprocess() method generates images synchronously and returns the result as a Blob. This method is available for image models only (lucy-pro-t2i and lucy-pro-i2i).
Method Signature
Parameters
The image model definition to use for generation.Available models:
models.image("lucy-pro-t2i")- Text-to-image generationmodels.image("lucy-pro-i2i")- Image-to-image editing
Text description for the generation or editing.
- Maximum length: 1000 characters
- For text-to-image: Describe what you want to generate
- For image-to-image: Describe the changes to apply
Required for image-to-image (
lucy-pro-i2i) only. The source image to edit.Accepted types:File- Browser File objectBlob- Binary dataReadableStream- Stream of dataURL- URL objectstring- URL stringReactNativeFile- React Native file format
Random seed for reproducible results.Using the same seed with identical prompt and settings produces the same output every time. Useful for testing and debugging.
Output resolution for the generated image.
Output orientation for the generated image.
Whether to enhance the prompt automatically.For best results, keep this enabled to let Decart’s AI enhance your prompts. Only disable if you need exact prompt control.Available for
lucy-pro-i2i only.Optional AbortSignal for canceling the request.
Return Value
Returns a Promise that resolves to a
Blob containing the generated image data.The Blob can be:- Converted to a URL using
URL.createObjectURL(blob) - Downloaded as a file
- Sent to a server
- Displayed in an
<img>element
Examples
Text-to-Image Generation
Generate an image from a text prompt:Image-to-Image Editing
Edit an existing image using a text prompt:With Cancellation
Cancel a long-running generation:Using with URLs
Edit an image from a URL:Error Handling
The method throws errors in the following cases:- Invalid inputs: When parameters don’t match the model’s input schema
- Network errors: When the API request fails
- Authentication errors: When the API key is invalid
- Abort errors: When the request is cancelled via AbortSignal
Notes
- Only image models (
lucy-pro-t2iandlucy-pro-i2i) support synchronous processing - For video generation, use the queue API instead
- Maximum prompt length is 1000 characters
- The method validates inputs against the model’s schema before sending the request
- File inputs are automatically converted to the appropriate format
Related Methods
- client.queue.submit() - For asynchronous video generation
- client.tokens.create() - For creating client-side API tokens