0

I have massive tiff file that contains 8 directories (resolutions). It's also a tiled.

I can cycle thru the directories and get the resolution of each. I want to save the 4th directory to a new tif file. I think it's possible but can't get my hands on it.

Basically want to do this:

using (LibTiff.Classic.Tiff image = LibTiff.Classic.Tiff.Open(file, "r"))
{
    if (image.NumberOfDirectories() > 4) {  
        image.SetDirectory(4);
        image.WriteDirectory("C:\\Temp\Test.tif");
    }
}

It would be so nice if that was possible but I know I have to create an output image and copy the rows of data into it. Not sure how yet. Any help would be much appreciated.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130
Matt
  • 169
  • 2
  • 6

1 Answers1

0

There are no built-in methods in LibTiff.Net library that can be used to copy one directory into a new file.

The task is quite complex and the best place to start is to look at TiffCP utility's source code.

The utility no only can copy images but it can also extract directories.

Bobrovsky
  • 13,789
  • 19
  • 80
  • 130