Normalization for IFFT for 2D image input

Dear All,

I am working on a project in which i am taking a 2D image as input and then extracting its pixel. After the extraction of the pixels the pixels are converted to imaginary values as per my requirement and a complex numbers are formulated with 0 real part and pixel values as imaginary part. After this i done FFT using CUFFT library. The FFT is done well but after doing IFFT, i am not getting the original results. I studied on CUFFT guide and also on this forum that i need to do scaling or normalization but i am not getting how to do it. I tried it but still not successful. I am attaching the code, if anyone gets some free time to look at that and do some midfications or just guide me how to do this. It will be very helpful for me and for my project.

Waiting for a favorable response.
Thanks

IFFT(FFT(A))=size(A)*A

If your image size is NM, you will need to scale your results by 1/(NM)