Copy/paste from grunt-spritesmith. Modifications to follow.