Implement dyeImage

Split loadImage into a common resource.js

Add a compatability check for both canvas-node and browser functionality

Note that the generated dyed image is off-by-one to the tested TMWW image.
The algorithm needs verification and possibly correction.

Either way, it's close enough by the eye.