Page 1 of 1

Read TIF multi-page

Posted: 2014-11-17T05:53:11-07:00
by User6789
Hi,

I would appreciate any help.

I am reading a TIFF file that has more than one page. But I only have access to the first page, and I need to read information from all them.

Anyone know how could I read the rest of the pages?

Thanks.

Re: Read TIF multi-page

Posted: 2014-11-17T06:08:00-07:00
by Bonzo
I know nothing about Magick++ but you could try input.tiff[1]
The pages will start at 0 so the first page will be [0] the second [1] etc.

Re: Read TIF multi-page

Posted: 2014-11-17T06:45:13-07:00
by User6789
Thanks Bonzo.

The solution is reading a list of

Code: Select all

Images
from a file.

Code: Select all

InitializeMagick(*argv);
list<Image> imageList; 
readImages( &imageList, "input.tif" );

int page = 0;
Image image = NULL;
for (list<Image>::iterator i=imageList.begin(); i != imageList.end(); i++){
     image = *i;
     image.write(to_string(page++) + ".png" );
}
This example extract each page in a PNG file named with their page number.