You could just do a return with the cvEncodeImage