Fix infinite loop in MeasureImageQuality.images_to_process