Skip to main content

openai_image

Python script for generating image from text by Open AI

openai_image

1. Install openai & openai-image

pip install openai


pip install openai-image

2. Recieve your OpenAI API KEY

https://platform.openai.com/account/api-keys

3. Settings

API_KEY = 'your-secret-openai-api-key'

PIC_SIZE = '256x256'

IMAGES = ''

TARGET_TEXT = ''

PIC_SIZE options :'256x256', '512x512', '1024x1024'

IMAGES options: if IMAGES = '', script will use current folder. But you can set your own dir, for example: IMAGES = 'D:\Pictures'

TARGET_TEXT options: TARGET_TEXT = '', you will input your target text from keyboard. And you can set it in code, for example TARGET_TEXT = 'Alice in Wonderland'

4. Use openai_image

import openai_image

Example1:

import openai_image

API_KEY = 'your-secret-openai-api-key'

PIC_SIZE = '256x256'

IMAGES = ''

TARGET_TEXT = ''

openai_image.get_image(API_KEY, PIC_SIZE, IMAGES, TARGET_TEXT)

Prompt target text: blue bird

openai_image blue bird

Your image file ready: blue_bird.png

Example2:

from openai_image import *

API_KEY = 'your-secret-openai-api-key'

PIC_SIZE = '256x256'

IMAGES = 'D:\Pictures\'

TARGET_TEXT = 'Alice in Wonderland'

get_image(API_KEY, PIC_SIZE, IMAGES, TARGET_TEXT)


openai image Alice in Wonderland

Your image file ready: D:\Pictures\Alice_in_Wonderland.png

Documentation

https://best-itpro.ru/news/openai_image/

That's All, Folks! ;)

Release files for openai-image 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-image 1.0.5
File Size Uploaded
openai-image-1.0.5.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openai-image 1.0.5
File Interpreter ABI Platform
openai_image-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 kB

Release files / openai-image-1.0.5.tar.gz

Download URL openai-image-1.0.5.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
daad4e9b29a5ae6ba04b2f0da218ca76fdecef2692e7de689996fe2b775ca260
BLAKE2b-256 checksum
How to use checksums
e0c44220c1289946052e27d60e36a412be8164ed448ad423741f69bd2ef613f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / openai_image-1.0.5-py3-none-any.whl

Download URL openai_image-1.0.5-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
781a6362c978378f858872bf685eb72a4624bb9458e4929ec0140c62a7d3c174
BLAKE2b-256 checksum
How to use checksums
58de62e9a4c292b25010823a3f120da14ea75876d80543d9404c7ea4f358e43d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page