see https://github.com/jcupitt/libvips/issues/290 thanks huskier added a write-to-buffer example as well