read from image file buffer