imgutils: add a function for copying image data from GPU mapped memory