/add-badge

Node commands to add an overlay badge.

Primary LanguageTypeScriptMIT LicenseMIT

Add Badge

Node commands to add an overlay badge, inset to the non-transparent area.

Installation

Using npm:

npm install --save-dev @sourcetoad/add-badge

Using yarn:

yarn add --dev @sourcetoad/add-badge

Usage

Add a badge to a single image:

npx add-badge <input-image> <output-image> <badge-text> [options]

Add a badge to multiple images, modifying them in-place:

npx add-badges <input-glob> <badge-text> [options]

See fast-glob for glob details.

Options

See samples for some previews.

Option Description Default
--font-file Text font file Roboto Black (Bundled)
--font-size Text size (pt, scaled for images not 192px) 28
--text-color Text color (transparent for transparent) #666666
--background-color Badge background color #ffffff
--gravity Badge gravity (northwest, north, northeast, southwest, south, southeast) southeast
--shadow-color Badge shadow color rgba(0,0,0,0.6)
--dry-run/-d Does not perform actions