Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dhravya/blog-banner-generator
Customisable, fast, easy to use blog banner generator
https://github.com/dhravya/blog-banner-generator
blog image image-generation pillow python
Last synced: 3 months ago
JSON representation
Customisable, fast, easy to use blog banner generator
- Host: GitHub
- URL: https://github.com/dhravya/blog-banner-generator
- Owner: Dhravya
- Created: 2022-05-14T18:17:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-16T01:53:34.000Z (over 2 years ago)
- Last Synced: 2024-10-04T16:56:25.642Z (4 months ago)
- Topics: blog, image, image-generation, pillow, python
- Language: Python
- Homepage: https://blog.dhravya.dev
- Size: 2.99 MB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Blog banner generator
I was tired of making banners for my blog posts, so I created a script that does it for me.
![Example](.github/assets/example.png)
## Installation
```bash
git clone https://github.com/Dhravya/blog-banner-generator.git
cd blog-banner-generator
pip install -r requirements.txt
```## Config
The default config works well, but if you want your banner to be a different colour, or change the positioning of elements, feel free to edit the [config file](src/config.py)
Here are the config options (note that this may break the script, because I haven't tested it out much)
`BG_COLOR` : `rgb(r, g, b)`
`ART_POSITION` : `Coordinates(x, y, size=(430, 430))`
`TITLE_POSITION` : `Coordinates(x, y)`
`IMG_POSITION` : `Coordinates(x, y)`
`FOOTER_POSITION` : `Coordinates(x, y)`
`FOOTER` : `""`
## Running the script
You can run the script by using the `generate()` method of the `ImageFactory` class```python
if __name__ == "__main__":
generator = ImageFactory()
generator.generate(
... # Options here
)
```Generate options:
`title`, `description`: Required, self explanatory
`art_img_path`: Optional, path to the image to be used as the "banner art" (image on the top left)
This can also be a URL, if it's a URL, the image will automatically be downloaded and used
To set a default value, you need to change [art.png](templates/art.png) in the `templates` folder.`img_path`: Optional, path to the image to be used as the "banner image" (the main display image)
This can also be a URL, if it's a URL, the image will automatically be downloaded and used
By default, it uses the [default.png](templates/default.png) in the `templates` folder. so you can change that if you want to change the default image`save_path` : Optional, path to save the image to. If not specified, it will save to `output.png`
`tags`: (List) Optional, list of tags to be used in the footer. Basically pastes the images as tags in the footer.
All the tags are sourced from the [icons](icons/) folder, add more tags in there with the appropriate name, and it will be used.
`resize_width`: Resize the output image to this width. If not specified, it will not resize.
## support
[Follow me on Github](https://github.com/dhravya)[Follow me on twitter](https://twitter.com/dhravyashah)