api fix and use the qimage directly instead of loading the tmp file again