Skip to content
An OpenBadges image baking library that works with PNGs and SVGs
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

openbadges-bakery Build Status


$ npm install openbadges-bakery

CLI Usage


$ oven [--in ./path/to/image.png] [--out ./path/to/baked-image.png] <data>

If --out is not set, the baked image will print to stdout.

The input file can also be piped into stdin.

$ oven <data> <  ./path/to/image.png  > ./path/to/baked-image.png


$ oven [--in path/to/image.png] --extract

Same as above, you can also pipe a file to stdin. The data will be printed to stdout.

Libary Usage

bakery.bake(options callback);

Bakes some data into an image.

Options are

  • image: either a buffer or a stream representing the PNG to bake
  • data: the data to put into the badge. At this point, it should likely be a URL pointing to a badge assertion

callback has the signature function(err, imageData)

bakery.debake(image, callback);

Gets the URL from a baked badge and attempts to retreive the assertion at the other end.

image should be a stream or a buffer

callback has the signature function (err, object) where object is expected to be a OpenBadges assertion.

bakery.extract(image, callback)

Gets the data from the baked badge.

callback has the signature function (err, data)

Something went wrong with that request. Please try again.