Utility for masking an image in Javascript.