png-load: Refactor stream handling to avoid reading twice

Also moves some things out to dedicated functions and adds
GError based error handling.
tests/compositions: Print exception if VERBOSE