Command line usage

The Jdenticon CLI tool can be used to generate identicons. You can also use it from build scripts etc.

npx jdenticon <value> [-s <size>] [-o <filename>]

Options

OptionDefault valueDescription
Property<value>All arguments that are not one of the arguments listed below, are concatenated and used as value. If the value is a hexadecimal string of at least 11 characters it is considered a hash and used as base for the icon. If it contains any other value it is hashed using SHA1.
Property-s
--size
100Sets the width and height of the generated icon in pixels.
Property-f
--format
pngFormat of the generated icon. If not specified, the format is automatically determined from the output path. Supported values are png and svg.
Property-o
--output
<stdout>Path to output file. If a path is specified, but --format isn't, the format is determined from the filename extension of the output path. If an output path is not specified, the generated icon is written to stdout.
Property-b
--back-color
transparentBackground color on format #rgb, #rgba, #rrggbb or #rrggbbaa.
Property-p
--padding
0.08Specifies the padding surrounding the icon in percents in the range 0.0 to 0.5. Additional padding might be inserted by Jdenticon to ensure the icon is aligned to the pixel grid.
Property-v
--version
Output the version number of Jdenticon to stdout.
Property-h
--help
Display help information.

Examples

In this example an icon is generated for the value "user127" with the shortest possible command line. It will create a PNG icon and write it to stdout.

npx jdenticon "user127"

Below is the --output option used to write the icon to a file. The format is determined from the filename. --back-color is used to remove the transparent background.

npx jdenticon "user127" --output "user127.svg" --back-color "#fff"