Move read_image up so jpegs can be made if analyze_image is not set