Texture pixel have max color from all pixels above

Hi. I want to make texture pixels get the max color value from itself and all pixels above. It should change something like this

into this

. I don’t know a lot about material editor, so maybe there already is a node for it or it’s not posible.