First, a caveat. I am discussing only printer profiles here. Matrix based display profiles and working spaces such as sRGB or ProPhoto use different mechanisms for Out of Gamut determinations.
Printer profile Out of Gamut masking works in Photoshop by selecting a profile in View Proof then hitting Ctrl-Shift-Y to enable/disable masking. A neutral gray replaces all portions of the image that are out of gamut. This means that the image color can't be printed but that a less saturated color will be printed instead.
But there are problems with it. When does Photoshop consider a color to be out of gamut? How reliable is the indication? And what does it mean, if anything in the different printing modes of Perceptual, Relative, Saturation, and Absolute Intents?
I've closely approximated Photoshop's algorithm in Matlab by creating L*a*b* slices in increments of L:5 from 5 to 95. Then, the images were round tripped through the printer profile and Delta E's were generated. A close match on all slices with Photoshop occurred when the break between in gamut and out of gamut had a Delta E of 6. Printable colors with less than a Delta E of 6 were then compared to the requested color and their differences were added to a neutral Lab(50,0,0). This allows one to see the actual color deviation when printed close to but outside the gamut boundary while within the Delta E of 6. Close inspection of the Matlab gamut map at L=50 shows a magenta hue on the left boundary and green hue on the right. This shows the color error near the gamut edge prior to reaching the cutoff of 6 dE. Photoshop generates correct OOG masking at 6 dE only for Relative and Absolute Colorimetric Intents.
Unfortunately, Perceptual and Saturation Intents are not colorimetric intents so OOG masking has no clear meaning. Photoshop appears to simply deal with this by treating these as if they were Relative Colorimetric. However, regular soft proofing with these intents works because, while the conversion to printer space is not defined colorimetrically, the colors shown (if within the display gamut) are colorimetric equivalents to the printed colors.
Attached are images of these Lab slices, processed by the Matlab program and a Photoshop masked view proof. There are fine grid lines at units of 10 along the a* and b*. Each pixel is at integer coordinates so the grid lines are spaced 10 pixels apart.
Here's things to keep in mind:
- Gamut masking is meaningful only in Relative and Absolute Intents.
- Gamut masking only occurs for colors that exceed 6 Delta E and that amount is easily visible but would provide no warning.
- Matrix based profiles use completely different algorithms. This only applies to LUT based output devices like printer profiles.