Hi Christian,

2010/6/2 Christian Henning <chhenning@gmail.com>
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

The code works. However, the output image is not compressed. It has the same size (in octets) as the  one which uses the default jpeg_tag.

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.

Could yo please also tell me more about this parameter?

Regards,

Olivier
 

Regards,
Christian

On Tue, Jun 1, 2010 at 8:57 PM, Olivier Tournaire <olitour@gmail.com> 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@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users