json-to-mask
You need to be a Pro member to access the full content of this.
json-to-mask converts a Labelme JSON file to a mask.

v0.1.2 (2025-03-28): Supports shape_type="mask".
Usage
As the argument, you can pass either a JSON file or directory of JSON files.
labelmetk json-to-mask [OPTIONS] FILE_OR_DIR...
To customize the behavior, use the following options:
--exclude-labels TEXT: Labels to exclude. If you have labels you’d like to exclude (e.g.,__ignore__label for the region you want to skip labeling) pass these into this option (e.g.,--exclude-labels __ignore__).--browse: Browse images on a browser. If you pass this option, the command opens the browser to show images as an table.--include-labels TEXT: Labels to only include. This is opposite to--exclude-labelsoption and can’t be used together.
Example: Convert a JSON file
If you only have a single JSON file, pass it to the command:
labelmetk json-to-mask small_dataset/2011_000003.json
to get a mask image:

Example: Convert a directory of JSON files
If you have multiple JSON files in a directory, pass the directory to the command:
labelmetk json-to-mask small_dataset
to get a mask image for each:
Example: Exclude some labels
If you’d like to exclude some of the labels when creating a mask, pass --exclude-labels:
labelmetk json-to-mask small_dataset --exclude-labels __ignore__
You can see the difference from the previous example:
Example: Include only some labels
If you’d like to only show some labels (e.g., person), pass --include-labels:
labelmetk json-to-mask small_dataset --include-labels person
You will get the mask only of "person" label annotations:
Example: Browse the result in a browser:
If you instantly browse the result on a browser, pass --browse (or -b)
labelmetk json-to-mask small_dataset --browse
It will show the output images as a table:

Download an example dataset from:
small_dataset.zip (389KB)