#image
1 messages · Page 1 of 1 (latest)
Hi @swift wharf. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To create an image of planets in space using OpenAI's image generation tools, you can use either the ChatGPT interface or the OpenAI API.
In ChatGPT:
Simply type your request, such as “Create an image of planets in space.” ChatGPT Images (powered by GPT-4o) will generate the image for you. You can also use the “Create image” option in the tool menu. If you want to edit an existing image, upload it and describe the changes you want to make. The Select tool allows you to select and edit specific areas of the image as well Creating images in ChatGPT.
With the OpenAI API (Python example):
from openai import OpenAI
import base64
client = OpenAI()
result = client.images.generate(
model="gpt-image-1",
prompt="Planets in space",
size="1024x1024"
)
image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)
with open("planets_in_space.png", "wb") as f:
f.write(image_bytes)
This code will generate an image of planets in space and save it as a PNG file Image generation guide.
You can further customize the output (size, quality, format, transparency) using the available parameters in the API API reference.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@swift wharf Kapa.ai is still learning and improving, please let me know how I did by reacting below.