Creating binary png masks


I have some JPEG images that i want to use in machine learning. The model i intend to use expects me to have annotated them to create category names and a binary mask exported as PNG format. Im trying to use image-j to do this. Ideally i want to manaually segment the region of interest in one color, with the background all as another color. Then export those masks as PNG. Is this possible using image J?

You can do this, but in general you should not use JPEG images for quantitative image analysis because it uses a lossy compression to reduce image size. It is much better to save your original images in a format that has a lossless compression such as TIF or PNG. The advantage of the TIF format for original data is that you can store metadata (e.g the calibration) in the header. This makes your life much easier down the road… See this for a more complete explanation.

ok, this is super good feedback - much appreciated. I didnt actually realise that JPEG was a lossy compresion format.

Is there any guidance on how to use Imagej to generate the masks - do i need to download an additional plugin? I also need to create a categories.txt with the file which shows the label name with respect to the colour used for masking!