Hi Christian,

2010/6/2 Christian Henning <chhenning@gmail.com>
Hi Olivier,

>
> 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.

On my system the jpeg with quality set to 100% is 20KB, whereas the
one with 30% for quality is only 4KB. Could you set a breakpoint in
boost\gil\extension\io_new\formats\jpeg\write.hpp[119]? That's where
the quality is set.


It finally works on one of my computer ... but on another one, I get a compilation error. Here is the (long) message :

/usr/local/include/boost/gil/extension/io_new/formats/jpeg/write.hpp: In function ‘typename Op::result_type boost::gil::detail::apply_operation_base(Bits&, size_t, const Info&, Op) [with Types = boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0>, Info = boost::gil::image_write_info<boost::gil::jpeg_tag, boost::gil::detail::no_log>, Bits = boost::gil::variant<boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0> >::base_t, Op = boost::gil::detail::dynamic_io_fnobj<boost::gil::detail::jpeg_write_is_supported, boost::gil::detail::writer<boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>, boost::gil::jpeg_tag, boost::gil::detail::no_log> >]’:

/usr/local/include/boost/gil/extension/io_new/formats/jpeg/write.hpp:269: instantiated from ‘typename BinaryOp::result_type boost::gil::detail::apply_operation(const boost::gil::variant<Types>&, const Info&, BinaryOp) [with Types1 = boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0>, Info = boost::gil::image_write_info<boost::gil::jpeg_tag, boost::gil::detail::no_log>, BinaryOp = boost::gil::detail::dynamic_io_fnobj<boost::gil::detail::jpeg_write_is_supported, boost::gil::detail::writer<boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>, boost::gil::jpeg_tag, boost::gil::detail::no_log> >]’

/usr/local/include/boost/gil/extension/io_new/formats/jpeg/write.hpp:309: instantiated from ‘void boost::gil::detail::dynamic_image_writer<Device, boost::gil::jpeg_tag, boost::gil::detail::no_log>::apply(const boost::gil::any_image_view<Views>&, const boost::gil::image_write_info<boost::gil::jpeg_tag, boost::gil::detail::no_log>&) [with Views = boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0>, Device = boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>]’

/usr/local/include/boost/gil/extension/io_new/detail/write_view.hpp:302: instantiated from ‘void boost::gil::write_view(Device&, const boost::gil::any_image_view<Types2>&, const boost::gil::image_write_info<FormatTag, Log>&, typename boost::enable_if<typename boost::mpl::and_<typename boost::gil::detail::is_output_device<IODevice>::type, typename boost::gil::is_format_tag<FormatTag>::type, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >::type, void>::type*) [with Device = boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>, Views = boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0>, FormatTag = boost::gil::jpeg_tag, Log = boost::gil::detail::no_log]’

/usr/local/include/boost/gil/extension/io_new/detail/write_view.hpp:357: instantiated from ‘void boost::gil::write_view(const String&, const boost::gil::any_image_view<Types2>&, const boost::gil::image_write_info<FormatTag, Log>&, typename boost::enable_if<typename boost::mpl::and_<typename boost::gil::detail::is_supported_path_spec<P>::type, typename boost::gil::is_format_tag<FormatTag>::type, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >::type, void>::type*) [with String = const char*, Views = boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0>, FormatTag = boost::gil::jpeg_tag, Log = boost::gil::detail::no_log]’

/home/olivier/work/dev/OTO_DEV/projects/tif2jpeg_for_itowns_viewer/main_tif2jpeg_for_itowns_viewer.cpp:43: instantiated from here

/usr/local/include/boost/gil/extension/io_new/formats/jpeg/write.hpp:244: error: no matching function for call to ‘boost::gil::detail::apply_operation_fwd_fn<2ul>::apply(boost::gil::variant<boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb16_pixel_t*> > >, boost::mpl::v_item<boost::gil::image_view<boost::gil::memory_based_2d_locator<boost::gil::memory_based_step_iterator<boost::gil::rgb8_pixel_t*> > >, boost::mpl::vector0<mpl_::na>, 0>, 0> >::base_t&, size_t&, const boost::gil::image_write_info<boost::gil::jpeg_tag, boost::gil::detail::no_log>&, boost::gil::detail::dynamic_io_fnobj<boost::gil::detail::jpeg_write_is_supported, boost::gil::detail::writer<boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>, boost::gil::jpeg_tag, boost::gil::detail::no_log> >&)’

/usr/local/include/boost/gil/extension/io_new/formats/jpeg/write.hpp:244: error: return-statement with a value, in function returning 'void'



If I comment the info parameter on line 242 of formats/jpeg/write.hpp, the compilation error disappears, but, the infos are not passed to the writer, what explain why my image is not compressed (the parameters are set to their default values). Could you please help on how to fix this error?
I am on a linux ubuntu karmic koala, boost 1.42, libjpeg 6.2, g++ 4.3.4

Best regards,

Olivier


>>
>> 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?

The dct parameter stands for discrete cosine transformation and it's
for selecting the appropriate method to do that transformation. In
some cases those calculation can be quite expensive.

Regards,
Christian
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users