Create cover images from Markdown posts
default to git mod date, fall back to fs metadata
add support for arbitrary titles/subtitles
handle pluralising minute(s)


browse  log 



You can also use your local clone with git send-email.


Go report card status REUSE status Donate with fosspay scratchanitch.dev badge

Generate cover images from Hugo posts


  • Clone the repository
  • Create a directory in the repository named fonts
  • Copy four OpenType font files into the directory
    • regular.otf
    • italic.otf
    • bold.otf
    • bold-italic.otf
  • Install the go toolchain
  • Run go install .
    • This bundles your selected fonts into the binary
  • Run the tool from the root of your Hugo site
    • Example: p2c -i content/posts/post.md -o public/post/cover.png
$ p2c -h

Usage: p2c [options]

  -h, --help                Show the help message
  -i, --input string        Path to input Markdown
  -M, --metasize int        Size of font for meta information (default 40)
  -o, --output string       Path to output PNG
  -t, --posttitle string    Title displayed in the generated image
  -P, --posttitlesize int   Size of font for post title (default 60)
  -S, --sitetitlesize int   Size of font for site title (default 50)
  -s, --subtitle string     Subtitle displayed in the generated image

example: p2c -i input.md -o output.png

p2c is meant for use with Hugo.

It looks at...
- The Markdown file's frontmatter fields for
  - title
  - date
- The site's config.{toml/yaml/yml} fields for
  - title (site title)
- The file's last modification date according to
  the git history, falling back to the filesystem
  metadata if git history is not available