Write pmg from the image format provided by http://npm.im/readimage