Optimisation for image processing