Thank you very much!! You saved me a lot of time.
By the way I’ve noticed that plotting the resulting image the last column and the first one are cut. I can’t understand why.
Edit: Ok I figured out the bug. It was in another part of the code.