Processing Traffic before it reaches the client

Is there a way to write something based on Pihole that will for example process all PNG files that are being called and process them (let's say add watermark)?


Nope, Pi-hole is a DNS sinkhole, wouldn't even know that PNG's are being downloaded.

But doesn't the request go thought the server (it does not see the url of the request?)
How would you suggest to approach that problem?


As said: Pi-hole is acting as a DNS-Server.

Accessing a resource like a PNG image via HTTP/HTTPS is a completely different story.

Refer to respective proxies or to browser extensions for what you try to achieve.

No, only DNS queries.

As Bucking_Horn notes, you'll need a proxy (squid or privoxy) but for most web sites that's not feasible, https is designed to prevent you from doing what your asking.