Histogram specification?

I think what you are looking for is the CLUT from after-before layers filter from g’mic: