If you get a x,y grid of pixels for each image, you could do your computation and then replace the pixel in the target image with the new value.