Optimise image script