I was tired of making banners for my blogs, so I automated it

Dhravya - May 15 '22 - - Dev Community

I'm a very lazy person, and always procrastinate on the smallest of things - opening the image editor, and making a good blog banner would always be the "extra" thing I had to do every time I wrote something. So, I made a script that generates them for me in milliseconds!

As Bill Gates says,

always choose a lazy person to do a difficult job because he will find an easy way to do it

The output is fully customizable, as it is 100% generated from code. You can change some values here and there, and boom! Generated. I ran it through all the posts of my blog and it quickly replaced many of the blog posts for me.

Check out the code Here (And ⭐ the post if you liked it!)

GitHub logo Dhravya / blog-banner-generator

Customisable, fast, easy to use blog banner generator

Blog banner generator

I was tired of making banners for my blog posts, so I created a script that does it for me.

Example

Installation

git clone https://github.com/Dhravya/blog-banner-generator.git
cd blog-banner-generator
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

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

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 : "<your small footer>"

Running the script

You can run the script by using the generate() method of the ImageFactory class

if __name__ == "__main__":
    generator = ImageFactory()
    generator.generate(
        ... # Options here
    )
Enter fullscreen mode Exit fullscreen mode

Generate options:

title, description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .