DEV Community

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

Posted on • Originally published at blog.dhravya.dev

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

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โ€ฆ

Top comments (4)

Collapse
 
mtwn105 profile image
Amit Wani

Only Laziness can solve world problems!๐Ÿ˜Ž

Collapse
 
john4650hub profile image
JohnDelvin

Thanks for the shortcut. Hey do you have a website where you put all your projects and documentation

Collapse
 
dhravya profile image
Dhravya

I do have a website, and you can find all projects and documentation on my github

Collapse
 
dhravya profile image
Dhravya

Also I post about all my projects on my own blog