CSS Mask Example

First image is the original 220+ kb PNG file. Second is a ~34kb JPG file masked by a ~1kb PNG file. ~16% size of the original.


Mask:

Code:

selector img{
-webkit-mask-image: url("path/to/mask.png");
-webkit-mask-size: 100% 100%;

mask-image: url(“path/to/mask.png”) ;
mask-size: 100% 100%;
}

Browser Support (by relative usage):


https://caniuse.com/#feat=css-masks