GIL: New file io, almost there, but can't compile 'write_view'

So, I had to deal with a lib I worked on last a couple of years ago. Great news, the file IO has been greatly simplified in 1.68. I was able to retire several dozens of cryptic,(for me), lines. The old code won't compile as the Adobe extensions are gone. I'm almost there, I can read files, but I don't understand why I can't get the writer to compile. I get to my code, in case it matters: bg::rgb8_image_t destImg( res, x ); resize_view( view( sourceImg ), view( destImg ), bg::bilinear_sampler( ) ); and rgb8_image_t should be a good one from what I read: <https://www.boost.org/doc/libs/1_68_0/libs/gil/doc/html/io.html> With either: bg::write_view( path_to, destImg, bg::jpeg_tag() ); or: bg::image_write_info<bg::jpeg_tag> write_setttings; bg::write_view( path_to, destImg, write_setttings ); ms140 complains: 1>C:\cpp\boost_1_68_0\boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp(33): error C2039: 'reference': is not a member of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> c:\cpp\boost_1_68_0\boost\gil\typedefs.hpp(176): note: see declaration of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> console_test.cpp(248): note: see reference to class template instantiation 'boost::gil::get_pixel_type<boost::gil::rgb8_image_t>' being compiled 1>C:\cpp\boost_1_68_0\boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp(34): error C2146: syntax error: missing '>' before identifier 'reference' What am I missing? Do I need to supply more information? I'll put the whole thing in a url if needed. Thanks, Dan.

On Sat, 8 Dec 2018 at 02:46, Dan Bloomquist via Boost-users <boost-users@lists.boost.org> wrote:
I get to my code, in case it matters: bg::rgb8_image_t destImg( res, x ); resize_view( view( sourceImg ), view( destImg ), bg::bilinear_sampler( ) );
and rgb8_image_t should be a good one from what I read: <https://www.boost.org/doc/libs/1_68_0/libs/gil/doc/html/io.html>
At glance, the docs look fine.
With either: bg::write_view( path_to, destImg, bg::jpeg_tag() ); or: bg::image_write_info<bg::jpeg_tag> write_setttings; bg::write_view( path_to, destImg, write_setttings );
ms140 complains: 1>C:\cpp\boost_1_68_0\boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp(33): error C2039: 'reference': is not a member of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> c:\cpp\boost_1_68_0\boost\gil\typedefs.hpp(176): note: see declaration of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> console_test.cpp(248): note: see reference to class template instantiation 'boost::gil::get_pixel_type<boost::gil::rgb8_image_t>' being compiled 1>C:\cpp\boost_1_68_0\boost/gil/extension/toolbox/metafunctions/get_pixel_type.hpp(34): error C2146: syntax error: missing '>' before identifier 'reference'
What am I missing?
I suspect, you are missing some headers. I have just updated GIL example resize.cpp to catch it up with the new GIL IO https://github.com/boostorg/gil/commit/531e671b4919420af029568e8e33ffb2baa47... I verified it compiles without errors using Visual Studio 2017 15.9.3 Preview 1.0 (FYI, I configured x64 build with Ninja using the CMake configuration provided and https://github.com/boostorg/gil/blob/develop/example/cmake/CMakeSettings.jso...) Please, git pull and git checkout develop branch, and try out the example if it compiles for you as well. I hope it does. If it does, compare your program against it to see what is different/missing. p.s. FYI, if you prefer, there is also https://lists.boost.org/mailman/listinfo.cgi/boost-gil Best regards, -- Mateusz Loskot, http://mateusz.loskot.net

Mateusz Loskot via Boost-users wrote:
At glance, the docs look fine.
With either: bg::write_view( path_to, destImg, bg::jpeg_tag() ); or: bg::image_write_info<bg::jpeg_tag> write_setttings; bg::write_view( path_to, destImg, write_setttings );
ms140 complains: 1>c:\cpp\boost_1_68_0\boost\gil\extension\toolbox\metafunctions\get_pixel_type.hpp(33): error C2039: 'reference': is not a member of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> c:\cpp\boost_1_68_0\boost\gil\typedefs.hpp(176): note: see declaration of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> c:\cpp\he_14\resize_jpeg\console_test.cpp(341): note: see reference to class template instantiation 'boost::gil::get_pixel_type<boost::gil::rgb8_image_t>' being compiled
I suspect, you are missing some headers.
Hi Mateusz, Thanks. So your example worked. I had a lot of headers so started there. I finally commented just about every thing I had and still had the issue. Even with VS2017. I should have started by just looking at your example write to file line for a subtle difference.. Here is what it was... bg::write_view( path_to, const_view( destImg), bg::jpeg_tag() ); ^^^^^^^^ need to use const_view!
p.s. FYI, if you prefer, there is also https://lists.boost.org/mailman/listinfo.cgi/boost-gil
More thanks. And I cross posted in case the likes of this comes up again. Best, Dan.

On Sat, 8 Dec 2018 at 20:19, Dan Bloomquist via Boost-users <boost-users@lists.boost.org> wrote:
Mateusz Loskot via Boost-users wrote:
With either: bg::write_view( path_to, destImg, bg::jpeg_tag() ); or: bg::image_write_info<bg::jpeg_tag> write_setttings; bg::write_view( path_to, destImg, write_setttings );
ms140 complains: 1>c:\cpp\boost_1_68_0\boost\gil\extension\toolbox\metafunctions\get_pixel_type.hpp(33): error C2039: 'reference': is not a member of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> c:\cpp\boost_1_68_0\boost\gil\typedefs.hpp(176): note: see declaration of 'boost::gil::image<boost::gil::rgb8_pixel_t,false,std::allocator<unsigned char>>' 1> c:\cpp\he_14\resize_jpeg\console_test.cpp(341): note: see reference to class template instantiation 'boost::gil::get_pixel_type<boost::gil::rgb8_image_t>' being compiled
I suspect, you are missing some headers.
Hi Mateusz, Thanks. So your example worked. I had a lot of headers so started there. I finally commented just about every thing I had and still had the issue. Even with VS2017.
I should have started by just looking at your example write to file line for a subtle difference.. Here is what it was...
bg::write_view( path_to, const_view( destImg), bg::jpeg_tag() );
^^^^^^^^ need to use const_view!
Dan, Hmm, it should compile with gil::view as well. I have just checked the resize.cpp modified with VS2017 bg::rgb8_image_t square100x100(100, 100); bg::resize_view(bg::view(img), bg::view(square100x100), bg::bilinear_sampler{}); bg::write_view("out-resize.jpg", bg::view(square100x100), bg::jpeg_tag{}); It compiles. If you still encoutner the problem, I suggest you to open a new issue at https://github.com/boostorg/gil and include minimal example to reproduce the problem Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
participants (2)
-
Dan Bloomquist
-
Mateusz Loskot