Boost logo

Boost Users :

Subject: Re: [Boost-users] How to convert cmyk jpg file to rgb jpg file with BOOST.GIL?
From: Guangchao Wang (guangchao0831_at_[hidden])
Date: 2013-11-12 21:11:51


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_at_[hidden]> wrote:

> On 12 November 2013 04:21, Guangchao Wang <guangchao0831_at_[hidden]> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net