AB
AiBoss
project

GPT-image-1 - OpenAI's latest image generation model

GPT-image-1 is a native multimodal image generation model released by OpenAI, available to developers via its API. The model generates high-quality, professional-grade images based on text prompts and images, supporting various styles and customization options...

What is GPT-image-1?

GPT-image-1 is a native multimodal image generation model launched by OpenAI, available to developers via its API. The model generates high-quality, professional-grade images based on text prompts and images, supporting various styles and customization options such as image quality, size, format, and compression level. It is widely used in creative design, e-commerce, education, and marketing, for example, converting sketches into graphics, generating product display images, and creating brand visual assets. It has already been adopted by major creative platforms including Adobe and Figma.

Main functions of GPT-image-1

  • Text to ImageGenerate an image based on the text description.
  • Image editing: To modify or partially edit an existing image.
  • Image variantsDifferent versions or style variations of the generated image.
  • Customization features:
    • sizeSupports multiple resolutions, such as 1024×1024, 1024×1536, etc.
    • qualityThree rendering quality options are available: low, medium, and high.
    • FormatSupports PNG, JPEG, WebP and other formats.
    • compressionFor JPEG and WebP formats, the compression level can be set from 0% to 100%.
    • backgroundSupports transparent or opaque backgrounds.
  • API accessProvides an API interface to support developers in integrating image generation functionality into their own applications or services, and supports batch image generation.

Features of GPT-image-1 model

  • Super strong command complianceIt accurately understands and executes complex instructions to ensure the accuracy of generated images.
  • Numerous art stylesSupports multiple art styles, suitable for different creative needs.
  • Precision Image EditingIt provides powerful image editing capabilities, allowing users to make fine adjustments to images based on text prompts.
  • Rich real-world knowledgeGenerate image content that is relevant to the real world, enhancing the credibility and usability of images.
  • Text Consistency GenerationIt maintains the consistency and coherence of text content when generating images, making it suitable for educational materials, storybooks, and other scenarios.

GPT-image-1 Product Pricing

  • Input the token (prompt text)$5 per 1 million tokens
  • Image input token (input image)$10 per 1 million tokens
  • Image output token (generated image)$40 per 1 million tokens

The project address for GPT-image-1

How to use GPT-image-1

  • Preparation: Ask OpenAIOfficial websiteRegister an account. After registration, log in to your account to obtain the API Key.
  • Install the OpenAI Python libraryInstall the official OpenAI libraries in your Python environment. Open a terminal or command prompt and run the following command:
pip install openai
  • Configure API key:Configure the OpenAI API key in your code. It is recommended to store the key in an environment variable to avoid exposing it directly in the code.
import os
import openai

# 设置API密钥
openai.api_key = os.getenv("OPENAI_API_KEY")
  • Call image to generate API:
    • Image generationGenerates images based on text prompts. Here is a simple example code:
import openai
import base64

# 初始化OpenAI客户端
client = openai.OpenAI()
# 调用图像生成API
result = client.images.generate(
 model="gpt-image-1",
# 指定模型
 prompt="A futuristic cityscape at sunset with flying cars and neon lights",
# 文本提示
 size="1024x1024",
# 图像尺寸
 quality="high",
# 图像质量
 background="transparent"
# 背景设置为透明
)
# 获取生成的图像数据
image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)
# 保存图像到本地文件
with
open("futuristic_cityscape.png",
"wb")
as f:
 f.write(image_bytes)
    • Image editingEdit an existing image. Here is a sample code:
import openai

# 初始化OpenAI客户端
client = openai.OpenAI()
# 调用图像编辑API
result = client.images.edit(
 model="gpt-image-1",
# 指定模型
 image=open("input_image.png",
"rb"),
# 上传需要编辑的图像
 mask=open("mask.png",
"rb"),
# 上传蒙版图像
 prompt="Replace the sky with a starry night",
# 编辑提示
 size="1024x1024",
# 图像尺寸
 quality="high"
# 图像质量
)
# 获取生成的图像数据
image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)
# 保存编辑后的图像到本地文件
with
open("edited_image.png",
"wb")
as f:
 f.write(image_bytes)
    • Generate a new image using a reference image:Upload multiple reference images to generate a new image. Here is a sample code:
import openai

# 初始化OpenAI客户端
client = openai.OpenAI()
# 调用参考图像生成API
result = client.images.edit(
 model="gpt-image-1",
# 指定模型
 image=[
open("body-lotion.png",
"rb"),
open("bath-bomb.png",
"rb"),
open("incense-kit.png",
"rb"),
open("soap.png",
"rb"),
],
# 上传参考图像
 prompt="Generate a photorealistic image of a gift basket on a white background labeled 'Relax & Unwind' with a ribbon and handwriting-like font, containing all the items in the reference pictures",
# 生成提示
 size="1024x1024",
# 图像尺寸
 quality="high"
# 图像质量
)
# 获取生成的图像数据
image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)
# 保存生成的图像到本地文件
with
open("gift_basket.png",
"wb")
as f:
 f.write(image_bytes)

Application Cases of GPT-image-1

  • AdobeIt integrates into Firefly and Express apps, offering different image styles.
  • FigmaIt generates and edits images based on simple prompts, helping designers quickly get ideas.
  • HeyGenEnhanced avatar creation and editing features.
  • WixHelp users quickly turn their ideas into reality.
  • PhotoroomHelps online sellers create studio-quality visuals based on product photos.

Application scenarios of GPT-image-1

  • Creative DesignQuickly convert sketches into high-quality graphic elements, supporting high-fidelity visual editing.
  • E-commerce and MarketingGenerate product display images, marketing posters, and social media images to enhance visual appeal.
  • Brand DesignCreate editable logos, brand visual assets, and professional typography.
  • Video creationEnhanced video editing features to generate high-quality avatars and animation effects.
  • Education and Content CreationGenerate teaching illustrations and creative content to support education and creation.