improve all the input image external area adapting it like the one in the reference image