I am in the process of converting a software package from Matlab to C++. As I was searching for a library that can read multipage tiff, I found that it can be done using Boost (GIL) however, my level of expertise is not good enough to understand how to use the library from the short tutorial given on their website. I was wondering if someone can send me a short example or explain to me how to use the library. I need to be able to read the tiff file frame by frame in any order so I need to be able to set the frame number I want to read. (in Matlab it’s just imread("fileName”, indexNumber) )

I greatly appreciate the help.

First off, I'm not an expert at GIL. I'm basing what I say based off of what I see at here. I don't see an option to look at a page in a tiff.

Why don't you take a look at libtiff, I found it in a quick google search. They have an example right on the page:

#include "tiffio.h"
main(int argc, char* argv[])
{
    TIFF* tif = TIFFOpen(argv[1], "r");
    if (tif) {
        int dircount = 0;
        do {
            dircount++;
        } while (TIFFReadDirectory(tif));
    printf("%d directories in %s\n", dircount, argv[1]);
    TIFFClose(tif);
    }
    exit(0);
}

I should caution you, that example looks like dated nonstandard C, but it should still work in a simular manner.

Thanks, yes I found this example, but then, I could not understand how to actualy access the image itself or its parameters (number of frames etc). Perhaps it's because I am not that experienced in C++. From what I read about Gil, it should be easy, but I need to improve my C++ knowledge to understand how to do it.

I could not understand how to actualy access the image itself

In that example, the name of the image is passed as a parameter too TIFFOpen on line 4. If you want, you can replace it with TIFF* tif = TIFFOpen("mypic.tff", "r"); Read that page more carefully, and you'll find the answer to your question.

I'm not sure what your reading about GIL. But from what it says here, it looks like it does not have support for multi-page tiffs.

Improving your C++ knowledge will be very advantageous. However, knowing more about C++, wont tell you more about the abilities of a particular library (learning more will help you understand the documentation though).

This question has already been answered. Start a new discussion instead.