This project utilizes the OpenAI API to perform various image-related tasks, including image generation, editing, inpainting, and creating images with transparent backgrounds. The project is structured into several Python scripts, each handling a specific task.
- Python 3.x
- OpenAI API key and organization ID
- Environment variables set for
OPENAI_API_KEYandOPENAI_ORGANIZATION - Required Python packages:
openai,python-dotenv,pydantic - If you get this error:
then you need to do this: To access the
openai.PermissionDeniedError: Error code: 403 - {'error': {'message': 'To access gpt-image-1, please complete organization verification: https://help.openai.com/en/articles/10910291-api-organization-verification', 'type': 'invalid_request_error', 'param': None, 'code': None}}gpt-image-1model, organization verification is required. Please complete the verification process as described here.
- Clone the repository.
- Install the required packages:
pip install openai python-dotenv pydantic
- Set up your environment variables in a
.envfile:OPENAI_API_KEY=your_api_key OPENAI_ORGANIZATION=your_organization_id
Generates a Studio Ghibli style image of a cat in a business suit with ninja cats. :D
- Output:
images_output/cat.png
Edits images to create a photorealistic image of a gift basket with specific items.
- Input: Images from
images_edit/ - Output:
images_output/gift-basket.png
Performs inpainting on an image to add a flamingo to a sunlit indoor lounge area.
- Input:
images_inpainting/sunlit_lounge.pngandimages_inpainting/mask.png - Output:
images_output/composition.png
Generates pixel art style images with transparent backgrounds based on prompts.
- Output: Images saved in
images_pixel_art_output/
To access the gpt-image-1 model, organization verification is required. Please complete the verification process as described here.