Take into account the return value of read and readinformation

Fixes a crash reported on the mailing list, we were ignoring the return value of read/readInformation, and thus manipulating a invalid image when generating thumbnails etc.