Helper functions for manipulating images using node canvas