extract-image converts a JSON file that contains image data to a file without by extracting the imageData to a JPEG file:

Untitled

Why do you want to use this tool?

Labelme saves the image you’re annotating into the JSON file by default as "imageData".

This is useful as you can copy or move the JSON file anywhere and still open the file.

However, when you want to keep the original image file (like JPEG/PNG format), you will have duplicate image data stored both in the JSON and the image file.

This wastes your storage.

For the new annotation, you can use labelme --nodata option to stop storing "imageData", but we need to do the conversion for old files.

This is when extract-image comes in.

Usage

As the argument, you can pass either a JSON file or directory of JSON files.

labelmetk extract-image [OPTIONS] FILE_OR_DIR