Update code for RGB data handling in preview callback