You can do this in Photoshop, & I would imagine Pixelmator or any other decent graphics package could in a similar manner…
Invert Colour can also be done in Gimp - freeware, open source. If you want to use Gimp, then I'd recommend this Mac-specific build from https://www.partha.com/ which looks & feels far more 'Mac-like' than the official build.
Load your image, use the Magic Wand or equivalent to select the background.
Layer Menu > Layer Mask > Hide selection
You've now generated the basic mask shape.
The next bit is a bit fiddly, but you can automate it for future use.
Opt/click this new mask, then select all. Copy, click the picture item in the Layer, Paste. This will generate a new layer containing the black & white image of your mask.
Drag your original mask to the new layer (both thumbnails will then look the same.)
Disable your original layer to save confusion.
Click the main image in the thumbnail & Invert (Cmd/i)
That's your first mask. Save as png.
PNG with transparency is a 32-bit file rather than 24. Some apps differentiate this way, others including Photoshop have a dedicated "save Transparency" option which changes the bit depth for you.
Undo the Invert (or Invert again) then Opt/click the Mask & Invert.
That's your 2nd mask. Again save as png.
You could, of course, do each of these as a new layer, then saving your file as PSD or other native format would preserve all assets in a single file.