More than one segmentation mask (InstanceURI) in one image

If there is more than one instance of one class on the image, an exported json provides separate instance URIs (one per instance). However, for some ML models is better to have an image with all instance segmentation masks. Is there a possibility to export one image with all masks or a script available to combine more than one instance masks in one? Any help is highly appreciated! Thanks!