CamanJS
CamanJS copied to clipboard
Introduce Layer Mask
In some personal projects I encounter the use case when I have to use layer mask to implement some Photoshop filters
Naively, we can embed the layer mask into the alpha channel and save the image as a png. This loses the compression ability of jpeg but can still work.
But, in order to mimic the Photoshop adjustment layer, then there is no workaround other than layer mask
So, for example, one can do the following to selectively brighten a specific portion of an image
this.newLayer(function () {
this.copyParent();
this.filter.exposure(10);
this.filter.contrast(15);
this.layerMask('layermask.jpg');
});