You can vary optimizations settings across an image (called weighted optimization) using masks to produces higher-quality results in critical image areas without greatly increasing file size. You can set weight optimization for the following settings:
Quality for JPEG images.
Dithering for GIF, PNG‑8, and WBMP images.
Lossy for GIF images.
Generated color table for GIF and PNG‑8, favoring colors in specific image areas.
To apply weighted optimization, you first create an alpha channel mask, or use the automatically generate mask for type layers and shape layers.
The white areas of the mask (which include type or shapes on shape layers) indicate the image areas that will have the highest level of image quality. The black areas are the least important parts of the image and will have lower JPEG quality, or the higher dithering and lossiness for GIF images. The level of optimization in gray areas of the mask varies depending on the gray level. For generated color tables, the white areas of the mask indicate important image areas, so more colors in the white areas are kept.