There are photoshop plugins around like
digimarc, which offer this as a professional service.
The software encrypts a bit of information in a bit pattern and then hides this pattern in your image numerous times. This will work ok as long as there is enough variation in the image, which usually is true for photographies. The information is somewhat resilient against manipulation like cropping and re-encoding, but there are limits to that.
The question is, what you want to achieve: A watermark, visible or not, does not prevent copyright infringement. If you want to prove that you have the rights as a photographer, possession of the raw files is usually enough to do that. You could also create a digital signature on a file to prove that you were in possession of that file at a certain time.
The only thing, that you can do with that, is tracking which recipient of an image leaked the image (if you personalize the tag you insert per recipient).
If you own a laser printer and you print a single character on it you will find a dot pattern in yellow on the page if you use a magnification device. The dot code will contain enough information to identify your very printer.