image refinement and color inversion