<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIC. - Artificial Intelligence Command > ! Open AI - DALL.E > Generate Image |
MiniRobotLanguage (MRL)
AIC.Generate Image
Use the Open AI-API Server to generate Images from a Text-Prompt
AI generated Pictures look often photorealistic, yet the Text generation is not always perfect.
Intention
The `AIC.Generate Image` command in the Smart-Package Robot (SPR) allows users to generate images through the OpenAI Image Generation Endpoint.
The command requires three parameters to generate images based on a text prompt.
Unlike other AI Systems, the OPEN AI - Text to Image System can work with very long an detailed prompts.
AIC.Generate Image|<Prompt>|<Filename>|<ImageSize>
1. `<Prompt>`: A text string that describes the image you want to generate. For example, "A sunset over the mountains."
2. `<Filename and path>`: The name for the file where the generated image will be saved. This can contain '****' which will be replaced by a unique image number. For example, "image_****.png" might become "image_0001.png".
3. `<ImageSize>`: The resolution of the image to be generated. It must be in the format `WIDTHxHEIGHT` and can range from `256x256` to `1024x1024`. For example, "512x512".
AIC.Generate Image|A beautiful landscape with a flowing river and trees|landscape_****.jpg|1024x1024
The costs for using the OpenAI Image Generation Endpoint through the SPR command are based on the resolution of the output image.
As of the time of writing, the costs are as follows:
- 256x256 resolution: $0.016 per image
- 512x512 resolution: $0.018 per image
- 1024x1024 resolution: $0.020 per image
Please note that if you are a new user of OpenAI’s API, you can benefit from a free trial that allows you to use $18 of free credits within your first three months. Keep in mind that pricing may change, so it's advisable to consult the official OpenAI documentation for the most current information.
OpenAI has policies in place to ensure ethical use of its services. Prompts that are assumed to be illegal, harmful, or offensive may be rejected.
It is essential to ensure that the content you generate complies with OpenAI's policies and ethical guidelines or else your Prompts will be rejected.
The OpenAI Images API is in public beta, which means that it might evolve and change significantly. It is also subject to rate limits of ten images per minute and twenty-five images per five minutes. It's advisable to keep this in mind if you are planning to use this command in a production environment.
Please consult the official OpenAI documentation for the most up-to-date information on the API parameters and pricing.
' Set OpenAI API-Key from the saved File
AIC.SetKey|File
' This will make the AI to generate 3 Pictures.
AIC.SetNumber|3
' Picture-Size can be 256 or 512 or 1024
AIC.Set Image Size|256
$$TXT=Chessboard with a nice golden Cowgirls on it.
AIC.Generate Image|$$TXT
' Uncomment these lines below to see the Original Output of the API
' in case of errors
'AIC.gro|$$ROW
'MBX.$$ROW
ENR.
Here you can see the other 2 pictures that have been created using the Dalle2-AI from Open AI.
Be aware that the AI will refuse to generate several types of pictures for ethical reasons.
In case you do not get a picture out of your prompt, you can use AIC.gro to read the original output of the Open AI Server.
In this case the word "Girl" in the prompt made the server to refuse to generate a picture.
Syntax
AIC.Generate Image|P1[|P2][|P3]
AIC.GIM|P1[|P2][|P3]
Parameter Explanation
P1 - Prompt/ Text that describes the Picture that you want to generate.
P2 - opt. File path and File name where you want the Picture to be saved. Please include "****" where the Picture number should be inserted.
P3 - opt. Picture size: This can only be one of these: "256x256", "512x512" or "1024x1024". If you omit this, "1024x1024" is chosen.
Example
'*****************************************************
' EXAMPLE 1: AIC.-Commands
'*****************************************************
' Set OpenAI API-Key from the saved File
AIC.SetKey|File
' This will make the AI to generate 3 Pictures
AIC.SetNumber|3
' Can be 256 or 512 or 1024
AIC.Set Image Size|256
$$TXT=Chessboard with a nice golden Cowgirls on a horse with 4 legs and an galactic atmospere.
AIC.Generate Image|$$TXT
' Use this to see the Original Output of the API
' in case of errors
'AIC.gro|$$ROW
'MBX.$$ROW
ENR.
Remarks
We can not take responsibility that the generated Images are free of Copyrights.
Generating Pictures with AI is currently a new process where the copyright situation is not perfectly clear.
Therefore take this into account for whatever you use these pictures.
Limitations:
At the time of the writing of this manual, DALLE 2 is the only official available Endpoint from OpenAI.
There are however rumors that DALLE 3 will soon be available. Possibly this newer model can be used if you chose another endpoint using the
AIC.Set Image Generation Endpoint - Command.
If there are more changes there will be an updated for the new model.
See also:
•