Skip to content

mozoarella/blogimagegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This program generates a header image for my blog at https://dylans.blog.

How to use it

Either run it directly with go run main.go or go build it and run the binary.

In either case use --help to get a full list of supported options.

Realistically you can use different typefaces with the program, but I've found that some typefaces do not survive Go's image generation very well. Open Sans seems to cope without issue, but Montserrat for example had holes in the glyphs or overlapping lines.

Example

An example header
This image was generated with the following command:

go run main.go --title "This is an example image generated by this program." --font fonts/OpenSans_SemiCondensed-Bold.ttf --output header.jpeg --fontsize 40 --format jpeg --quality 80 --width 750 --height 300

I recommend you play with the fontsize a bit depending on the text you're placing on the image. I think it's aesthetically pleasing when text fills out a good portion of the image and does not wrap on awkward spots.

Credit

Included image neoncity.jpg was created by Yiran Ding on Unsplash

The code is mostly adapted from this blogpost with some added CLI options to make it easier to use. They do some more stuff like adding additional text and making a gif out of it if you're interested.

Contribute

I'm not likely to actually take contributions on this, the code is fairly simple and serves a single purpose. If you want to build upon it just fork it and go nuts.

License

neoncity.jpg from aforementioned Unsplash user is not mine to re-license and is still under the Unsplash license

Open Sans is released under the Open Font License

The code in this repository is released Unlicensed and therefore in the public domain.

About

Go program to generate header images for my blog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages