Move some stuff around, delete copied image_data in read_image_from_stream, collapse reading of width and height for image