Check if encoding has changed
Store image encoding in comment
Try not to send headers twice to some listeners
fromImage is deprecated
Optimized gray-scale path, rgb8
fromImage can throw cv::Exception on bayer encoded images
Break this function into pieces
Handle RGB8 or MONO8 efficiently