# YouTube Thumbnail Generator
An AI-powered YouTube thumbnail generator that leverages Stable Diffusion and Large Language Models (LLM) to create custom, eye-catching thumbnails based on a given topic.
## Table of Contents
- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Detailed Function Descriptions](#detailed-function-descriptions)
- [Customization](#customization)
- [Logging](#logging)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)
- [License](#license)
## Features
- **Intelligent Thumbnail Ideation**: Utilizes LLM to generate creative thumbnail concepts and asset prompts.
- **High-Quality Asset Generation**: Employs Stable Diffusion 3 to create visually appealing assets.
- **Automated Thumbnail Assembly**: Combines generated assets into cohesive thumbnails.
- **Background Removal**: Supports automatic background removal from assets for cleaner integration.
- **Text Overlay**: Adds customizable text to thumbnails for increased engagement.
- **Image Optimization**: Ensures output images are optimized for YouTube's requirements.
## Requirements
- Python 3.7+
- gradio_client
- Pillow
- rembg
- colorama
- Custom LLM implementation (llm/llama.py)
## Installation
1. Clone this repository:
```
git clone https://github.com/yourusername/youtube-thumbnail-generator.git
cd youtube-thumbnail-generator
```
2. Install the required packages:
```
pip install gradio_client Pillow rembg colorama
```
3. Set up the custom LLM implementation:
- Ensure you have the `llm/llama.py` file in your project directory.
- Follow any additional setup instructions for your specific LLM implementation.
4. Configure environment variables:
- Set `ASSET_DIR_PATH` to specify where generated assets should be stored.
- (Optional) Set any API keys or credentials required for Stable Diffusion or your LLM.
## Usage
1. Run the script:
```
python yt_thumb_gen.py --topic "Your Topic"
```
2. The generated thumbnail will be saved to the path specified in `THUMBNAIL_PATH`.
## Configuration
Modify the following variables in the script to customize the thumbnail generation:
- `THUMBNAIL_PATH`: Path where the final thumbnail will be saved.
- `FONT_SIZE`: Default font size for text on thumbnails.
- `ASSET_DIR_PATH`: Directory to store generated assets.
- `THUMBNAIL_SIZE`: Size of the generated thumbnail (default: 1280x720).
## Detailed Function Descriptions
### `generate_asset(prompt)`
Generates an image asset using Stable Diffusion based on the given prompt.
### `extract_code(response)`
Extracts Python code from LLM responses for further processing.
### `generate_assets(topic)`
Generates all necessary assets for a thumbnail based on the given topic.
### `add_to_thumbnail(thumbnail, asset_path, x, y)`
Adds an asset to the thumbnail at the specified (x, y) coordinates.
### `add_text_to_thumbnail(thumbnail, text, position, font_size, color)`
Adds text to the thumbnail with customizable position, font size, and color.
### `save_thumbnail(thumbnail)`
Saves the final thumbnail to the specified path.
### `remove_bg_from_asset(asset_path)`
Removes the background from an asset using the rembg library.
## Customization
To generate thumbnails for different topics:
1. Open `yt_thumb_gen.py` in your preferred text editor.
2. Locate the `__main__` section at the bottom of the script.
3. Modify the `topic` variable with your desired thumbnail topic.
4. Save the file and run the script as described in the [Usage](#usage) section.
## Logging
The script uses colorized logging via the `colorama` library to provide clear feedback on the thumbnail generation process. Different colors are used to highlight various stages and potential issues:
- Green: Successful operations
- Yellow: Warnings or important information
- Red: Errors or critical issues
- Blue: Processing steps
## Troubleshooting
- **Asset Generation Fails**: Ensure you have proper API credentials for Stable Diffusion and that your internet connection is stable.
- **LLM Errors**: Check that your custom LLM implementation is correctly set up and that any required models are properly loaded.
- **File Permission Issues**: Verify that the script has write permissions for the `ASSET_DIR_PATH` and `THUMBNAIL_PATH` directories.
- **Missing Dependencies**: Run `pip install -r requirements.txt` to ensure all required packages are installed.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgements
- [Stable Diffusion](https://stability.ai/) for providing the image generation capabilities.
- The developers of [rembg](https://github.com/danielgatis/rembg) for the background removal functionality.
- All contributors who have helped shape and improve this project.
---
For any questions or support, please open an issue on the GitHub repository.
Raw data
{
"_id": null,
"home_page": null,
"name": "yt-thumbnail-creator",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "python, video, youtube, thumbnail, photos, stable-diffusion",
"author": "S Likhith Sai",
"author_email": "semalalikithsai@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ee/84/e8468d73cda1d907878dbaf46d903d4a8022897d6a13833982b0f0414397/yt_thumbnail_creator-0.1.1.tar.gz",
"platform": null,
"description": "# YouTube Thumbnail Generator\r\n\r\nAn AI-powered YouTube thumbnail generator that leverages Stable Diffusion and Large Language Models (LLM) to create custom, eye-catching thumbnails based on a given topic.\r\n\r\n## Table of Contents\r\n\r\n- [Features](#features)\r\n- [Requirements](#requirements)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Configuration](#configuration)\r\n- [Detailed Function Descriptions](#detailed-function-descriptions)\r\n- [Customization](#customization)\r\n- [Logging](#logging)\r\n- [Troubleshooting](#troubleshooting)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Features\r\n\r\n- **Intelligent Thumbnail Ideation**: Utilizes LLM to generate creative thumbnail concepts and asset prompts.\r\n- **High-Quality Asset Generation**: Employs Stable Diffusion 3 to create visually appealing assets.\r\n- **Automated Thumbnail Assembly**: Combines generated assets into cohesive thumbnails.\r\n- **Background Removal**: Supports automatic background removal from assets for cleaner integration.\r\n- **Text Overlay**: Adds customizable text to thumbnails for increased engagement.\r\n- **Image Optimization**: Ensures output images are optimized for YouTube's requirements.\r\n\r\n## Requirements\r\n\r\n- Python 3.7+\r\n- gradio_client\r\n- Pillow\r\n- rembg\r\n- colorama\r\n- Custom LLM implementation (llm/llama.py)\r\n\r\n## Installation\r\n\r\n1. Clone this repository:\r\n ```\r\n git clone https://github.com/yourusername/youtube-thumbnail-generator.git\r\n cd youtube-thumbnail-generator\r\n ```\r\n\r\n2. Install the required packages:\r\n ```\r\n pip install gradio_client Pillow rembg colorama\r\n ```\r\n\r\n3. Set up the custom LLM implementation:\r\n - Ensure you have the `llm/llama.py` file in your project directory.\r\n - Follow any additional setup instructions for your specific LLM implementation.\r\n\r\n4. Configure environment variables:\r\n - Set `ASSET_DIR_PATH` to specify where generated assets should be stored.\r\n - (Optional) Set any API keys or credentials required for Stable Diffusion or your LLM.\r\n\r\n## Usage\r\n\r\n1. Run the script:\r\n ```\r\n python yt_thumb_gen.py --topic \"Your Topic\"\r\n ```\r\n2. The generated thumbnail will be saved to the path specified in `THUMBNAIL_PATH`.\r\n\r\n## Configuration\r\n\r\nModify the following variables in the script to customize the thumbnail generation:\r\n\r\n- `THUMBNAIL_PATH`: Path where the final thumbnail will be saved.\r\n- `FONT_SIZE`: Default font size for text on thumbnails.\r\n- `ASSET_DIR_PATH`: Directory to store generated assets.\r\n- `THUMBNAIL_SIZE`: Size of the generated thumbnail (default: 1280x720).\r\n\r\n## Detailed Function Descriptions\r\n\r\n### `generate_asset(prompt)`\r\nGenerates an image asset using Stable Diffusion based on the given prompt.\r\n\r\n### `extract_code(response)`\r\nExtracts Python code from LLM responses for further processing.\r\n\r\n### `generate_assets(topic)`\r\nGenerates all necessary assets for a thumbnail based on the given topic.\r\n\r\n### `add_to_thumbnail(thumbnail, asset_path, x, y)`\r\nAdds an asset to the thumbnail at the specified (x, y) coordinates.\r\n\r\n### `add_text_to_thumbnail(thumbnail, text, position, font_size, color)`\r\nAdds text to the thumbnail with customizable position, font size, and color.\r\n\r\n### `save_thumbnail(thumbnail)`\r\nSaves the final thumbnail to the specified path.\r\n\r\n### `remove_bg_from_asset(asset_path)`\r\nRemoves the background from an asset using the rembg library.\r\n\r\n## Customization\r\n\r\nTo generate thumbnails for different topics:\r\n\r\n1. Open `yt_thumb_gen.py` in your preferred text editor.\r\n2. Locate the `__main__` section at the bottom of the script.\r\n3. Modify the `topic` variable with your desired thumbnail topic.\r\n4. Save the file and run the script as described in the [Usage](#usage) section.\r\n\r\n## Logging\r\n\r\nThe script uses colorized logging via the `colorama` library to provide clear feedback on the thumbnail generation process. Different colors are used to highlight various stages and potential issues:\r\n\r\n- Green: Successful operations\r\n- Yellow: Warnings or important information\r\n- Red: Errors or critical issues\r\n- Blue: Processing steps\r\n\r\n## Troubleshooting\r\n\r\n- **Asset Generation Fails**: Ensure you have proper API credentials for Stable Diffusion and that your internet connection is stable.\r\n- **LLM Errors**: Check that your custom LLM implementation is correctly set up and that any required models are properly loaded.\r\n- **File Permission Issues**: Verify that the script has write permissions for the `ASSET_DIR_PATH` and `THUMBNAIL_PATH` directories.\r\n- **Missing Dependencies**: Run `pip install -r requirements.txt` to ensure all required packages are installed.\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n1. Fork the repository\r\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\r\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\r\n4. Push to the branch (`git push origin feature/AmazingFeature`)\r\n5. Open a Pull Request\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Acknowledgements\r\n\r\n- [Stable Diffusion](https://stability.ai/) for providing the image generation capabilities.\r\n- The developers of [rembg](https://github.com/danielgatis/rembg) for the background removal functionality.\r\n- All contributors who have helped shape and improve this project.\r\n\r\n---\r\n\r\nFor any questions or support, please open an issue on the GitHub repository.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Generating Thumbnail for everyone",
"version": "0.1.1",
"project_urls": null,
"split_keywords": [
"python",
" video",
" youtube",
" thumbnail",
" photos",
" stable-diffusion"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b8d69cad1f828ac39a34ec6d769afacadd77ffa68a43b40bcd78cdba3b1ffe7c",
"md5": "6b3a6d6e453038c3e9418c1ed763a67a",
"sha256": "32a9a6f3ad053c07ae0e644e4a4ec936f9aa352fc0b8bc3cf20c74453ddceb24"
},
"downloads": -1,
"filename": "yt_thumbnail_creator-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6b3a6d6e453038c3e9418c1ed763a67a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10818,
"upload_time": "2024-08-22T13:52:47",
"upload_time_iso_8601": "2024-08-22T13:52:47.911984Z",
"url": "https://files.pythonhosted.org/packages/b8/d6/9cad1f828ac39a34ec6d769afacadd77ffa68a43b40bcd78cdba3b1ffe7c/yt_thumbnail_creator-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ee84e8468d73cda1d907878dbaf46d903d4a8022897d6a13833982b0f0414397",
"md5": "953fe61b3c216fac32f0c507300e3e6e",
"sha256": "d76f95888fdd14ae97f322882a059b5b9d7404b0754392c25be58ac56f7b3d0c"
},
"downloads": -1,
"filename": "yt_thumbnail_creator-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "953fe61b3c216fac32f0c507300e3e6e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 11932,
"upload_time": "2024-08-22T13:52:49",
"upload_time_iso_8601": "2024-08-22T13:52:49.818708Z",
"url": "https://files.pythonhosted.org/packages/ee/84/e8468d73cda1d907878dbaf46d903d4a8022897d6a13833982b0f0414397/yt_thumbnail_creator-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-22 13:52:49",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "yt-thumbnail-creator"
}