Add to_vec function for writing PNG data to a Vec<u8>. …
This mostly copies the implementation of store_png, and could probably be refactored to share more code in the future.