Automate image optimisation

(Mergeable version of #123)
Yes, because you'd avoid potential merge conflicts.
But no, because it makes the build time longer.