|
Boost Users : |
Subject: [Boost-users] [gil io_new] Problem writing a compressed jpeg
From: Olivier Tournaire (olitour_at_[hidden])
Date: 2010-06-02 02:57:11
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 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