Hi again.. guess I'm a bit late to the party again...
Just to clearify one thing: dynamic property values in directive attributes need to be handled in the directive itself. They are not resolved before, for the reason that the directives are run at compile time and it's output is then rendered into the temporary template file, which then only later is executed for rendering on each request itself. Hence the real resolved values it not yet available at this point.
BUT, for your described use case of just finding and processing all images a theme uses, I can imagine that there are other ways images or other assets are consumed outside of an <img> directive. I.e. as background images for inline css like
<div class="slider">
<div class="slide" style="background-image: url(path/to/image.jpg)" />
</div>
In order to fetch these cases as well, it might be worth a minute to think about it and decide if it would be a better idea to use a token filter instead:
<picture>
<source srcset="{{ @heroImgLarge | image }}" media="(min-width: 600px)">
<img src="{{ @heroImg | image }}">
</picture>
You can then register a custom "image" filter with this method
https://fatfreeframework.com/3.8/preview#filter and process the image path in there, copy / move the file, optimize it and return a new path. This way you can use the image path in other components as well, like meta og:image tags, as data attribute for javascript things, etc.
hope this helps.