Useful util method! We use this in `resizeImages.js` as well (and maybe `capture.js`?), could you update those libraries to use this method as well?