Boost logo

Boost Users :

Subject: Re: [Boost-users] [gil io_new] Problem writing a compressed jpeg
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-06-02 03:31:05


Hi Olivier, your code looks good and runs on my machine without any
problems. Could you please describe what your problem is? Please make
sure you have the latest of gil and gil::io_new

BTW, you can pass strings into the io_new interface. No need for
c_str(). Also the jpeg_dct_method::fastest parameter works just fine.

Regards,
Christian

On Tue, Jun 1, 2010 at 8:57 PM, Olivier Tournaire <olitour_at_[hidden]> wrote:
> Hi all,
>
> I am currently trying to write a compressed jpeg image without any success.
> Here is my code:
>
> #include <string>
>
> #include <boost/mpl/vector.hpp>
>
> #include <boost/gil/gil_all.hpp>
> #include <boost/gil/extension/io_new/tiff_read.hpp>
> #include <boost/gil/extension/io_new/tiff_write.hpp>
> #include <boost/gil/extension/io_new/jpeg_read.hpp>
> #include <boost/gil/extension/io_new/jpeg_write.hpp>
>
> using namespace std;
> using namespace boost;
> using namespace gil;
>
> int main(int argc, char** argv)
> {
>     string base_image_path(argv[1]);
>     string output_image_path(argv[2]);
>     string output_compressed_image_path(argv[3]);
>
>     typedef mpl::vector<
>             rgb8_image_t,
>             rgb16_image_t
>     > rgb_image_types;
>     typedef any_image<rgb_image_types> any_image_type;
>     typedef any_image_type::view_t any_view_type;
>
>     // Read tiff image
>     image_read_info< tiff_tag > info = read_image_info( base_image_path
>                                                    , tiff_tag() );
>
>     any_image_type input_image;
>     read_image(base_image_path.c_str(), input_image, tiff_tag());
>
>     write_view(output_image_path.c_str(), view(input_image), jpeg_tag());
>
>     image_write_info< jpeg_tag > compressed_jpeg_info;
>     compressed_jpeg_info._quality = 30;
>     //compressed_jpeg_info._dct_method = jpeg_dct_method::fastest;
>     write_view(output_compressed_image_path.c_str(), view(input_image),
> compressed_jpeg_info);
> }
>
> Could you please help me ?
>
> Regards,
>
> Olivier
>
> _______________________________________________
> 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