Changed it so you can pick reference image file, also reduces memory footprint