Thanks for your help, but with your logic the output jpg file incorrect.
I worked with vs2008, first time when I tried to used boost gil library to load JPEG/JPG files, I found that the the libjpeg library is needed, I tried to build the libjpeg library, but the *.dsw file which created by the build command line, can't be opened by the vs2008, so I creates a library project myself and imported the files of libjoeg library into this project, the project can be built and I can get the libjpeg.lib file, with this library I load 8BPP and 24BPP RGB color type jpg files succesfully, but I can't make the CMYK image work well, I wonder if the way I used to build the libjpeg correct.
Following code works well:
cmyk8_image_t cmyk;
jpeg_read_image("CMYK.jpg", cmyk);