It'd be great if there was a bot that subscribed to Gerrit changes which add or modify .PNG files. It would run a PNG optimizer and Zopfli against each PNG. If it can successfully reduce the file-size of any PNG, it will commit the result and submit it to Gerrit for review.
Closing for now in favour of T98640, for the use case of project-logos in mediawiki-config.git – which I believe is what may've prompted this task.
For other projects, other solutions may be used. For example, oojs-ui uses a build script for use locally with a Jenkins job that confirms the build script is a no-op. This could be further developed to also amend commits in Gerrit, but that's up to individual projects and also raises its own questions with regards to security and verifiability - out of scope for Performance Team in my opinion.
As for our perspective, it seems teams are using recommended tools (OptiPNG, Zopfli) and actively applying them, which is great.