# openai_image
Python script for generating image from text by Open AI
<img src="https://igorman2005.github.io/images/openai-image.jpg" alt="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**
<img src="https://igorman2005.github.io/images/blue_bird.jpg" alt="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)
```
<img src="https://igorman2005.github.io/images/Alice_in_Wonderland.jpg" alt="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!
;)
Raw data
{
"_id": null,
"home_page": "https://github.com/IgorMan2005/openai_image/",
"name": "openai-image",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "openai image api open ai python",
"author": "IgorMan",
"author_email": "igorman2005@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e0/c4/4220c1289946052e27d60e36a412be8164ed448ad423741f69bd2ef613f3/openai-image-1.0.5.tar.gz",
"platform": null,
"description": "# openai_image\r\nPython script for generating image from text by Open AI\r\n\r\n\r\n<img src=\"https://igorman2005.github.io/images/openai-image.jpg\" alt=\"openai_image\">\r\n\r\n\r\n**1. Install openai & openai-image**\r\n\r\n\r\n```\r\npip install openai\r\n\r\n\r\npip install openai-image\r\n```\r\n\r\n\r\n**2. Recieve your OpenAI API KEY**\r\n\r\nhttps://platform.openai.com/account/api-keys\r\n\r\n\r\n\r\n**3. Settings**\r\n\r\n```\r\nAPI_KEY = 'your-secret-openai-api-key'\r\n\r\nPIC_SIZE = '256x256'\r\n\r\nIMAGES = ''\r\n\r\nTARGET_TEXT = ''\r\n```\r\n\r\nPIC_SIZE options :'256x256', '512x512', '1024x1024'\r\n\r\nIMAGES options: if IMAGES = '', script will use current folder. But you can set your own dir, for example: IMAGES = 'D:\\Pictures'\r\n\r\nTARGET_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'\r\n\r\n**4. Use openai_image**\r\n\r\n```\r\nimport openai_image\r\n```\r\n\r\n*Example1:*\r\n\r\n```\r\nimport openai_image\r\n\r\nAPI_KEY = 'your-secret-openai-api-key'\r\n\r\nPIC_SIZE = '256x256'\r\n\r\nIMAGES = ''\r\n\r\nTARGET_TEXT = ''\r\n\r\nopenai_image.get_image(API_KEY, PIC_SIZE, IMAGES, TARGET_TEXT)\r\n\r\n```\r\nPrompt target text: **blue bird**\r\n\r\n<img src=\"https://igorman2005.github.io/images/blue_bird.jpg\" alt=\"openai_image blue bird\">\r\n\r\nYour image file ready: **blue_bird.png**\r\n\r\n\r\n\r\n*Example2:*\r\n\r\n```\r\nfrom openai_image import *\r\n\r\nAPI_KEY = 'your-secret-openai-api-key'\r\n\r\nPIC_SIZE = '256x256'\r\n\r\nIMAGES = 'D:\\Pictures\\'\r\n\r\nTARGET_TEXT = 'Alice in Wonderland'\r\n\r\nget_image(API_KEY, PIC_SIZE, IMAGES, TARGET_TEXT)\r\n\r\n\r\n```\r\n\r\n<img src=\"https://igorman2005.github.io/images/Alice_in_Wonderland.jpg\" alt=\"openai image Alice in Wonderland\">\r\n\r\nYour image file ready: **D:\\Pictures\\Alice_in_Wonderland.png**\r\n\r\n\r\n### Documentation\r\n\r\nhttps://best-itpro.ru/news/openai_image/\r\n\r\n\r\nThat's All, Folks! \r\n;)\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Python script for generating image from text by Open AI",
"version": "1.0.5",
"project_urls": {
"Documentation": "https://best-itpro.ru/news/openai_image/",
"Homepage": "https://github.com/IgorMan2005/openai_image/"
},
"split_keywords": [
"openai",
"image",
"api",
"open",
"ai",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58de62e9a4c292b25010823a3f120da14ea75876d80543d9404c7ea4f358e43d",
"md5": "b5b8969516055649591bcdb19b82241d",
"sha256": "781a6362c978378f858872bf685eb72a4624bb9458e4929ec0140c62a7d3c174"
},
"downloads": -1,
"filename": "openai_image-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b5b8969516055649591bcdb19b82241d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4061,
"upload_time": "2023-06-27T17:55:38",
"upload_time_iso_8601": "2023-06-27T17:55:38.340688Z",
"url": "https://files.pythonhosted.org/packages/58/de/62e9a4c292b25010823a3f120da14ea75876d80543d9404c7ea4f358e43d/openai_image-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e0c44220c1289946052e27d60e36a412be8164ed448ad423741f69bd2ef613f3",
"md5": "db13d6e4fc897834c82bbe2db1b7d507",
"sha256": "daad4e9b29a5ae6ba04b2f0da218ca76fdecef2692e7de689996fe2b775ca260"
},
"downloads": -1,
"filename": "openai-image-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "db13d6e4fc897834c82bbe2db1b7d507",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3583,
"upload_time": "2023-06-27T17:55:40",
"upload_time_iso_8601": "2023-06-27T17:55:40.023407Z",
"url": "https://files.pythonhosted.org/packages/e0/c4/4220c1289946052e27d60e36a412be8164ed448ad423741f69bd2ef613f3/openai-image-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-27 17:55:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "IgorMan2005",
"github_project": "openai_image",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "openai-image"
}