Attach the load handler to the image to only run once per image

Previously, Chrome 26 would run the load handler once on the source image, then again on the already grayscaled image. Firefox 20 would run the load handler once on the source image, then infinitely on the grayscaled image, causing 100% CPU usage as it was constantly grayscaling the image. Older browser versions may have exhibited similar issues, but were not explicitly tested.

This change ensures that the grayscaling is only run once at most for each source image.

Sorry for the excess whitespace deletions, my editor removes all excess whitespace on save.