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);

jpeg_write_view("CMYK.jpg", const_view(cmyk));

so I think I do something wrong to make the default convert function not work.

Could you please give me some suggestion on how to build the libjpeg and how to convert CMYK to RGB image?

Thank you very much.

On Tue, Nov 12, 2013 at 7:34 PM, Mateusz Loskot <mateusz@loskot.net> wrote:
On 12 November 2013 04:21, Guangchao Wang <guangchao0831@gmail.com> wrote:
> I used following  code:
>
> rgb8_image_t rgb8Img;
>
> jpeg_read_and_convert_image("CMYK.jpg", rgb8Img); //CMYK.jpg is CMYK image
>
> jpeg_write_view("RGB.jpg", const_view(rgb8Img));
>
> to convert CMYK image to RGB image.
>
> The saved RGB.jpg is not correct.
>
> Could you give me some suggestion?

Try this to see if all steps separately will work:

cmyk8_image_t cmyk;
jpeg_read_image("CMYK.jpg", cmyk);

rgb8_image_t rgb(cmyk.dimensions());
copy_pixels(color_converted_view<rgb8_pixel_t>(view(cmyk)), view(rgb));

jpeg_write_view("RGB.jpg", const_view(rgb));

Best regards,
--
Mateusz  Loskot, http://mateusz.loskot.net
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users