Robots.txt only works after you’ve NoIndexed existing image URLs. Otherwise Googlebot will never be able to reach those URLs in the first place.
If there’s no direct/simple way to achieve this, another way of addressing my concern would be – how to ensure Publii doesn’t generate dedicated pages/URLs for Images? This has been a major issue with Yoast SEO on WordPress sites in the past.