Boost.GIL IO and Toolbox extensions accepted into Boost

I have just announced results of the formal review of IO and Toolbox extensions for Boost Generic Image Library (GIL). Shortly, formally, the review concluded with 1 NO and 7 YES votes what means both extensions have been accepted into Boost C++ Libraries.

The task has been finished, but the mission is still ongoing. Lubomir Bourdev (Adobe) – Boost.GIL lead developer summarised it quite well:

The problem with I/O is that you can never declare success.
All we can hope for is push the boundary as much as we can, and leave the rest for the next update.

Christian Henning has done great job developing the extensions and reviewers confirmed it. It was pleasure for me to manage the review process.

Formal Review of IO and Toolbox extensions to Boost.GIL starts TOMORROW

I am honoured to act as a Boost Review Manager for the proposed Boost.GIL.IO and Boost.GIL.Toolbox extensions. Today, I announced the review starting tomorrow:

According to the Boost Formal Review Schedule, review of Christian Henning’s extensions to the Boost Generic Image Library (Boost.GIL), it is:

  • Boost.GIL.IO
  • Boost.GIL.Toolbox

starts on December 1st and lasts until December 10th, 2010.

What is it?

The Boost.GIL.IO extension provides an easy to use interface for reading and writing various image formats. It also includes a framework for adding new formats. The Boost.GIL.IO is indent to replace the current IO extension which is part of Boost for several years now.

  • A unified way to read and write image encoded in BMP, JPEG, PNG, PNM and TIFF formats. The capabilities to read and write in various formats have improved dramatically.
  • Image data can be provided via standard file or string streams.
  • The Boost.GIL.Toolbox provides new color spaces and other small code to ease programming with Boost.GIL.

  • Implementation of color spaces: Gray_Alpha, HSL, HSV, LAB, and XYZ.
  • Utilities to support dynamic image workflows and color conversions.
  • Collection of metafunctions to determine alignment, similarity and homogeneity at pixel level.

The Boost.GIL as well as the proposed extensions are provided in form of a headers-only library Although, some image formats come with their format dependency, it is corresponding third-party libraries:

Getting the library

The latest version of both extensions can be downloaded as boost_review.zip package or directly from the Subversion repository. The docs can built as usual with bjam and quickbook tools from within libs/gil/io_new/doc directory. The libs/gil/io_new/test/readme.txt provides a step by step guide to configuring, building and running the unit tests. (By the way, here are some more details on how we’ve managed to get the Boost.GIL tests building with Boost.Build and Boost.Build extensions

The boost_review.zip is about 20MB due to its extensive collection of test images. They are part of the test suite to make sure that different variations of each image format is read and written correctly. Please, be aware no guarantee can be given that all formats in their all variants are completely supported.

Writing a review

If you feel the new IO and Toolbox are interesting extensions to the Boost.GIL library, then please submit your review to the developer list (preferably), or to the review manager.

Here are some questions you might want to answer in your review:

  • What is your evaluation of the design?
  • What is your evaluation of the implementation?
  • What is your evaluation of the documentation?
  • What is your evaluation of the potential usefulness of the extensions?
  • Did you try to use the extensions? With what compiler? Did you have any problems?
  • How much effort did you put into your evaluation? A glance? A quick reading? In-depth study?
  • Are you knowledgeable about the problem domain?
  • And finally, every review should answer this question:

  • Do you think the extensions should be accepted as a part of Boost.GIL library?
  • Be sure to say this explicitly so that your other comments don’t obscure your overall opinion.

Updating Boost.Build extensions

I’ve been continuing my Boost.Build adventures leading to preparation for review of the new Boost.GIL I/O framework. Here is a short patch with update I had to applie to Boost.Build extensions scripts for the libraries: jpeg-8a, libtiff 3.9.4 and zlib 1.2.4. It is boost-build_extensions-r66346-update.patch

This patch allowed me to successfully compile Boost.GIL tests. It’s been posted to the Boost mailing list, so perhaps it will be integrated with boost_extensions in the Boost Sandbox repository.

Notes on Boost.Build for Boost.GIL

Update: Updating Boost.Build extensions

Christian Henning, Boost.GIL developer, has been working intensively on design and implementation of the new image I/O extensions for Boost.GIL. It is Boost.GIL I/O v2. Official review of this piece of software by the Boost project Community is coming soon.

I have been playing with this new I/O lately myself and building it mostly using manually crafted solutions for Microsoft Visual Studio.
I decided to learn a bit more about the mysterious Boost.Build, so I can configure all Boost.GIL dependencies resolution in Jamfile and make testing process more portable.

Below, I include some notes of how I accomplished it. However, due to the cryptic nature of Boost.Build and my honest lack of understanding of this system, I have found my way through this configuration following bumpy path of trial and error. Thus, my findings may seem
weird to Boost.Build zealots and there surely is better way of doing it. Basically, I will use Boost.Build extensions – a very nice project which has a chance to become official part of the Boost.Build.

Here is directories layout I used in the following configuration with base path tagged using {DEV}. So, wherever you see the {DEV} tag in examples below, just substitute it with your own location:

$ cd {DEV}
$ ls -1
build_extensions
deps
Jamroot
output
test_images
trunk

First, checkout sources of Boost C++ libraries from the trunk in the Subversion repository:

$svn co http://svn.boost.org/svn/boost/trunk trunk

Second, get copy of the Boost.Build extensions from the Boost Sandbox – a place for software closely related but not included in official Boost:

svn co http://svn.boost.org/svn/boost/sandbox/tools/build_extensions/ build_extensions

Third, configure a couple of environment variables to locate Boost.Build components:

$ export BOOST_BUILD={DEV}/trunk/tools/build/v2
$ export BOOST_BUILD_PATH={DEV}/build_extensions/ext

Fourth, grab source code of dependencies of Boost.GIL I/O extensions like libjpeg, libpng, zlib, libtiff and install them by repeating the following two-steps procedure:

for library in (jpeg, libpng, zlib)
   download library
   unpack lib to {DEV}/deps

Fifth, get the new Boost.GIL I/O extensions. Current version at the moment of posting these notes is available as boost_review.zip package. Unpack it and copy content of boost directory in to boost subtree – {DEV}/trunk/boost, content of libs to {DEV}/trunk/libs. Basically, files of the GIL extensions should be installed in the following locations:

{DEV}/boost/gil/extension/io_new
{DEV}/trunk/boost/gil/extension/toolbox
{DEV}/trunk/libs/gil/io_new

Sixth, create empty Jamroot file:

$touch {DEV}/trunk/libs/gil/Jamroot

I found this file is required to not to confuse Boost.Build unnecessarily and without this file executing bjam throws a bunch of cryptic errors starting with:

trunk/tools/build/v2/build/virtual-target.jam:452: in _adjust-name from module object(file-target)@904
error: <tag>@rulename is present but is not the only </tag>feature

Finally, create Jamfile building your program based on Boost.GIL with all image format libraries specified as dependencies. As a quick test, I have modified (shorten) {DEV}/trunk/libs/gil/io_new/test/Jamfile.v2 to build one of tests for JPEG:

$ cat {DEV}/trunk/libs/gil/io_new/test/Jamfile.v2
import testing ;
using jpeg : 6a : {DEV}/deps/jpeg-8a ;

project
    : requirements
        <library>/boost/test//boost_unit_test_framework
        <link>static
    ;

test-suite "gil::io_new"
    :
        [ run jpeg_read_test.cpp /ext/jpeg//jpeg ]
    ;

Quick check if the test program builds and runs:

$ bjam
...patience...
...
gcc.link bin/jpeg_read_test.test/gcc-4.4.5/debug/link-static/jpeg_read_test
testing.capture-output bin/jpeg_read_test.test/gcc-4.4.5/debug/link-static/jpeg_read_test.run
**passed** bin/jpeg_read_test.test/gcc-4.4.5/debug/link-static/jpeg_read_test.test
...updated 9 targets...

Note, that executing bjam will build all the third-party libraries from their sources, as dependencies of Boost.GIL, and next all targets of your own binaries being dependant on Boost.GIL. No extra Jamfiles for libjpeg, libpng and other libraries are required. Here simply the magic of Boost.Build and its extensions kicks in.

If you need to use other formats, you need to import other libraries as well. Like this:

using zlib : 1.2.4 : {DEV}/deps/zlib-1.2.4 ;
using png : 1.4.0 : {DEV}/deps/libpng-1.4.1 ;

As I have mentioned, I not an expert of Boost.Build but rather wigwaging through its matter. So, if you’ve found an error or better solution please let me know. At the same time, if you have problems with applying my notes, it may mean they don’t present correct solution and I’d suggest rather to ask on the Boost mailing lists or IRC channel #boost than asking me.

Introduction to Boost Geometry slides

Boost Geometry (aka Generic Geometry Library, GGL)Slides of my very gentle introduction to Boost Geometry library are now available to download from the FOSS4G 2010 website.

The presentation gives a basic overview of the library and tries to explain how it is different to existing solutions but in such way so it’s also understandable to non-C++ programmers. Those who are looking forward to digging out very details of Boost Geometry, I recommend to check presentation which Barend Gehrels gave at BoostCon 2010.