moved rgb2gray conversion inside worker