Thanks , it works now: I can  save the images of each channel in JPEG format now.
 Before the Scott's solutions, I try to save the image of each channel in other formats, like png, pnm,tiff and bmp which are surpported by vil, however, only png works,  other formats failed.

For bmp, the runtime outputs are:
vilalgo_example: /home/harrison/code/vxlscr/core/vil/file_formats/vil_bmp.cxx:40
2: virtual bool vil_bmp_image::put_view(const vil_image_view_base&, unsigned int
, unsigned int): Assertion `nplanes()==3' failed.

For pnm format, though there are no errors when runing the application, the results  are abviously wrong. I tested using lena.jpg
For tiff format, all the three ouput images are identicall, though the three channel are different.

Other format are not tested.